|
| 1 | +/* |
| 2 | +** Command & Conquer Generals Zero Hour(tm) |
| 3 | +** Copyright 2025 TheSuperHackers |
| 4 | +** |
| 5 | +** This program is free software: you can redistribute it and/or modify |
| 6 | +** it under the terms of the GNU General Public License as published by |
| 7 | +** the Free Software Foundation, either version 3 of the License, or |
| 8 | +** (at your option) any later version. |
| 9 | +** |
| 10 | +** This program is distributed in the hope that it will be useful, |
| 11 | +** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +** GNU General Public License for more details. |
| 14 | +** |
| 15 | +** You should have received a copy of the GNU General Public License |
| 16 | +** along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | +*/ |
| 18 | + |
| 19 | +// TheSuperHackers @compile feliwir 15/04/2025 Simple allocator implementation useful for tools |
| 20 | +#include "always.h" |
| 21 | +#include <stdlib.h> |
| 22 | + |
| 23 | +#ifdef _OPERATOR_NEW_DEFINED_ |
| 24 | + |
| 25 | +void *operator new(size_t size) |
| 26 | +{ |
| 27 | + return malloc(size); |
| 28 | +} |
| 29 | + |
| 30 | +void *operator new[](size_t size) |
| 31 | +{ |
| 32 | + return malloc(size); |
| 33 | +} |
| 34 | + |
| 35 | +void operator delete(void *p) |
| 36 | +{ |
| 37 | + free(p); |
| 38 | +} |
| 39 | + |
| 40 | +void operator delete[](void *p) |
| 41 | +{ |
| 42 | + free(p); |
| 43 | +} |
| 44 | + |
| 45 | +void* operator new(size_t size, const char * fname, int) |
| 46 | +{ |
| 47 | + return malloc(size); |
| 48 | +} |
| 49 | + |
| 50 | +void operator delete(void * p, const char *, int) |
| 51 | +{ |
| 52 | + free(p); |
| 53 | +} |
| 54 | + |
| 55 | +void* operator new[](size_t size, const char * fname, int) |
| 56 | +{ |
| 57 | + return malloc(size); |
| 58 | +} |
| 59 | + |
| 60 | +void operator delete[](void * p, const char *, int) |
| 61 | +{ |
| 62 | + free(p); |
| 63 | +} |
| 64 | + |
| 65 | +#endif |
0 commit comments