From b3b85806060013f660002a7c5e2d2e7d07efd1d1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 23 Jul 2014 13:47:47 -0300 Subject: [PATCH] comments + proper undef of compatibility macros + no need to undef internal macros (this is the first definition) --- ltests.h | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/ltests.h b/ltests.h index 3c86a8f8..3cd8230a 100644 --- a/ltests.h +++ b/ltests.h @@ -1,5 +1,5 @@ /* -** $Id: ltests.h,v 2.34 2013/11/08 17:36:05 roberto Exp roberto $ +** $Id: ltests.h,v 2.35 2014/07/18 13:27:45 roberto Exp roberto $ ** Internal Header for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -10,11 +10,23 @@ #include -/* do not use compatibility macros in Lua code */ -#undef LUA_COMPAT_API +/* test Lua with no compatibility code */ +#undef LUA_COMPAT_MATHLIB +#undef LUA_COMPAT_BITLIB +#undef LUA_COMPAT_APIUNSIGNED +#undef LUA_COMPAT_FLOATSTRING +#undef LUA_COMPAT_UNPACK +#undef LUA_COMPAT_LOADERS +#undef LUA_COMPAT_LOG10 +#undef LUA_COMPAT_LOADSTRING +#undef LUA_COMPAT_MAXN +#undef LUA_COMPAT_MODULE + #define LUA_DEBUG + +/* turn on assertions */ #undef NDEBUG #include #define lua_assert(c) assert(c) @@ -24,7 +36,7 @@ #define UNUSED(x) (x=0, (void)(x)) -/* memory allocator control variables */ +/* memory-allocator control variables */ typedef struct Memcontrol { unsigned long numblocks; unsigned long total; @@ -42,19 +54,14 @@ extern Memcontrol l_memcontrol; extern void *l_Trick; -void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize); - - -typedef struct CallInfo *pCallInfo; +/* +** Function to traverse and check all memory used by Lua +*/ int lua_checkmemory (lua_State *L); /* test for lock/unlock */ -#undef luai_userstateopen -#undef luai_userstatethread -#undef lua_lock -#undef lua_unlock struct L_EXTRA { int lock; int *plock; }; #define LUAI_EXTRASPACE sizeof(struct L_EXTRA) @@ -70,8 +77,10 @@ struct L_EXTRA { int lock; int *plock; }; #define lua_unlock(l) lua_assert(--(*getlock(l)->plock) == 0) + int luaB_opentests (lua_State *L); +void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize); #if defined(lua_c) #define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol) @@ -93,3 +102,4 @@ int luaB_opentests (lua_State *L); #endif +