diff options
Diffstat (limited to 'lmem.c')
-rw-r--r-- | lmem.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.c,v 1.67 2004/12/01 15:46:18 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.68 2005/01/14 14:21:16 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 | */ |
@@ -22,19 +22,19 @@ | |||
22 | 22 | ||
23 | /* | 23 | /* |
24 | ** About the realloc function: | 24 | ** About the realloc function: |
25 | ** void * realloc (void *ud, void *ptr, size_t osize, size_t nsize); | 25 | ** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); |
26 | ** (`osize' is the old size, `nsize' is the new size) | 26 | ** (`osize' is the old size, `nsize' is the new size) |
27 | ** | 27 | ** |
28 | ** Lua ensures that (ptr == NULL) iff (osize == 0). | 28 | ** Lua ensures that (ptr == NULL) iff (osize == 0). |
29 | ** | 29 | ** |
30 | ** * realloc(ud, NULL, 0, x) creates a new block of size `x' | 30 | ** * frealloc(ud, NULL, 0, x) creates a new block of size `x' |
31 | ** | 31 | ** |
32 | ** * realloc(ud, p, x, 0) frees the block `p' | 32 | ** * frealloc(ud, p, x, 0) frees the block `p' |
33 | ** (in this specific case, realloc must return NULL). | 33 | ** (in this specific case, frealloc must return NULL). |
34 | ** particularly, realloc(ud, NULL, 0, 0) does nothing | 34 | ** particularly, frealloc(ud, NULL, 0, 0) does nothing |
35 | ** (which is equivalent to free(NULL) in ANSI C) | 35 | ** (which is equivalent to free(NULL) in ANSI C) |
36 | ** | 36 | ** |
37 | ** realloc returns NULL if it cannot create or reallocate the area | 37 | ** frealloc returns NULL if it cannot create or reallocate the area |
38 | ** (any reallocation to an equal or smaller size cannot fail!) | 38 | ** (any reallocation to an equal or smaller size cannot fail!) |
39 | */ | 39 | */ |
40 | 40 | ||
@@ -76,7 +76,7 @@ void *luaM_toobig (lua_State *L) { | |||
76 | void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { | 76 | void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { |
77 | global_State *g = G(L); | 77 | global_State *g = G(L); |
78 | lua_assert((osize == 0) == (block == NULL)); | 78 | lua_assert((osize == 0) == (block == NULL)); |
79 | block = (*g->realloc)(g->ud, block, osize, nsize); | 79 | block = (*g->frealloc)(g->ud, block, osize, nsize); |
80 | if (block == NULL && nsize > 0) | 80 | if (block == NULL && nsize > 0) |
81 | luaD_throw(L, LUA_ERRMEM); | 81 | luaD_throw(L, LUA_ERRMEM); |
82 | lua_assert((nsize == 0) == (block == NULL)); | 82 | lua_assert((nsize == 0) == (block == NULL)); |