From f36038e42a1c6d4920ee01b31a59946b6df07a05 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 25 Oct 2002 18:29:20 -0300 Subject: assertion must be always valid (not only in debug mode) --- lmem.c | 3 ++- ltests.c | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lmem.c b/lmem.c index 158a4023..6622ea9a 100644 --- a/lmem.c +++ b/lmem.c @@ -1,5 +1,5 @@ /* -** $Id: lmem.c,v 1.57 2002/06/18 15:19:27 roberto Exp roberto $ +** $Id: lmem.c,v 1.58 2002/10/08 18:45:07 roberto Exp roberto $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ @@ -61,6 +61,7 @@ void *luaM_growaux (lua_State *L, void *block, int *size, int size_elems, ** generic allocation routine. */ void *luaM_realloc (lua_State *L, void *block, lu_mem oldsize, lu_mem size) { + lua_assert((oldsize == 0) == (block == NULL)); if (size == 0) { if (block != NULL) { l_free(block, oldsize); diff --git a/ltests.c b/ltests.c index 3571b537..93a2b8e0 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 1.137 2002/10/22 18:07:55 roberto Exp roberto $ +** $Id: ltests.c,v 1.138 2002/10/25 20:05:28 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -95,7 +95,6 @@ static void freeblock (void *block) { void *debug_realloc (void *block, size_t oldsize, size_t size) { - lua_assert((oldsize == 0) == (block == NULL)); lua_assert(oldsize == 0 || oldsize == *blocksize(block)); /* ISO does not specify what realloc(NULL, 0) does */ lua_assert(block != NULL || size > 0); -- cgit v1.2.3-55-g6feb