diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-11 14:47:50 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-11 14:47:50 -0200 |
| commit | 0ffc676ce7ea4764f3277ce87967ef14ad323933 (patch) | |
| tree | 2582dabfc21f150b20c69a03ddfc9f896bc564d3 /lmem.c | |
| parent | 18fb3ddb897564178bebec44dbe04fabcebf39c5 (diff) | |
| download | lua-0ffc676ce7ea4764f3277ce87967ef14ad323933.tar.gz lua-0ffc676ce7ea4764f3277ce87967ef14ad323933.tar.bz2 lua-0ffc676ce7ea4764f3277ce87967ef14ad323933.zip | |
details
Diffstat (limited to 'lmem.c')
| -rw-r--r-- | lmem.c | 26 |
1 files changed, 12 insertions, 14 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.c,v 1.35 2000/08/04 19:38:35 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.36 2000/08/09 19:16:57 roberto Exp roberto $ |
| 3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -15,15 +15,6 @@ | |||
| 15 | #include "lstate.h" | 15 | #include "lstate.h" |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | /* | ||
| 19 | ** Real ISO (ANSI) systems do not need these tests; | ||
| 20 | ** but some systems (Sun OS) are not that ISO... | ||
| 21 | */ | ||
| 22 | #ifdef OLD_ANSI | ||
| 23 | #define realloc(b,s) ((b) == NULL ? malloc(s) : (realloc)(b, s)) | ||
| 24 | #define free(b) if (b) (free)(b) | ||
| 25 | #endif | ||
| 26 | |||
| 27 | 18 | ||
| 28 | 19 | ||
| 29 | #ifdef DEBUG | 20 | #ifdef DEBUG |
| @@ -38,11 +29,8 @@ | |||
| 38 | #include <limits.h> | 29 | #include <limits.h> |
| 39 | #include <string.h> | 30 | #include <string.h> |
| 40 | 31 | ||
| 41 | #undef realloc | ||
| 42 | #undef malloc | ||
| 43 | #undef free | ||
| 44 | #define realloc(b, s) debug_realloc(b, s) | 32 | #define realloc(b, s) debug_realloc(b, s) |
| 45 | #define malloc(b) debug_realloc(NULL, 0) | 33 | #define malloc(b) debug_realloc(NULL, b) |
| 46 | #define free(b) debug_realloc(b, 0) | 34 | #define free(b) debug_realloc(b, 0) |
| 47 | 35 | ||
| 48 | 36 | ||
| @@ -119,6 +107,16 @@ static void *debug_realloc (void *block, size_t size) { | |||
| 119 | 107 | ||
| 120 | 108 | ||
| 121 | 109 | ||
| 110 | /* | ||
| 111 | ** Real ISO (ANSI) systems do not need these tests; | ||
| 112 | ** but some systems (Sun OS) are not that ISO... | ||
| 113 | */ | ||
| 114 | #ifdef OLD_ANSI | ||
| 115 | #define realloc(b,s) ((b) == NULL ? malloc(s) : (realloc)(b, s)) | ||
| 116 | #define free(b) if (b) (free)(b) | ||
| 117 | #endif | ||
| 118 | |||
| 119 | |||
| 122 | void *luaM_growaux (lua_State *L, void *block, size_t nelems, | 120 | void *luaM_growaux (lua_State *L, void *block, size_t nelems, |
| 123 | int inc, size_t size, const char *errormsg, size_t limit) { | 121 | int inc, size_t size, const char *errormsg, size_t limit) { |
| 124 | size_t newn = nelems+inc; | 122 | size_t newn = nelems+inc; |
