diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-10-25 18:29:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-10-25 18:29:20 -0300 |
commit | f36038e42a1c6d4920ee01b31a59946b6df07a05 (patch) | |
tree | a22a46cdb38fdce183fad148e5863b58dd0ae736 | |
parent | 96e15b8501e5d8fc40c475cbac573f910ab5853b (diff) | |
download | lua-f36038e42a1c6d4920ee01b31a59946b6df07a05.tar.gz lua-f36038e42a1c6d4920ee01b31a59946b6df07a05.tar.bz2 lua-f36038e42a1c6d4920ee01b31a59946b6df07a05.zip |
assertion must be always valid (not only in debug mode)
-rw-r--r-- | lmem.c | 3 | ||||
-rw-r--r-- | ltests.c | 3 |
2 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.c,v 1.57 2002/06/18 15:19:27 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.58 2002/10/08 18:45:07 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 | */ |
@@ -61,6 +61,7 @@ void *luaM_growaux (lua_State *L, void *block, int *size, int size_elems, | |||
61 | ** generic allocation routine. | 61 | ** generic allocation routine. |
62 | */ | 62 | */ |
63 | void *luaM_realloc (lua_State *L, void *block, lu_mem oldsize, lu_mem size) { | 63 | void *luaM_realloc (lua_State *L, void *block, lu_mem oldsize, lu_mem size) { |
64 | lua_assert((oldsize == 0) == (block == NULL)); | ||
64 | if (size == 0) { | 65 | if (size == 0) { |
65 | if (block != NULL) { | 66 | if (block != NULL) { |
66 | l_free(block, oldsize); | 67 | l_free(block, oldsize); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.137 2002/10/22 18:07:55 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.138 2002/10/25 20:05:28 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -95,7 +95,6 @@ static void freeblock (void *block) { | |||
95 | 95 | ||
96 | 96 | ||
97 | void *debug_realloc (void *block, size_t oldsize, size_t size) { | 97 | void *debug_realloc (void *block, size_t oldsize, size_t size) { |
98 | lua_assert((oldsize == 0) == (block == NULL)); | ||
99 | lua_assert(oldsize == 0 || oldsize == *blocksize(block)); | 98 | lua_assert(oldsize == 0 || oldsize == *blocksize(block)); |
100 | /* ISO does not specify what realloc(NULL, 0) does */ | 99 | /* ISO does not specify what realloc(NULL, 0) does */ |
101 | lua_assert(block != NULL || size > 0); | 100 | lua_assert(block != NULL || size > 0); |