diff options
| -rw-r--r-- | ltests.c | 22 | ||||
| -rw-r--r-- | ltests.h | 8 |
2 files changed, 15 insertions, 15 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.42 2007/04/17 13:19:53 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.43 2007/06/21 13:48:04 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 | */ |
| @@ -37,7 +37,7 @@ | |||
| 37 | #if defined(LUA_DEBUG) | 37 | #if defined(LUA_DEBUG) |
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | int Trick = 0; | 40 | int l_Trick = 0; |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | static lua_State *lua_state = NULL; | 43 | static lua_State *lua_state = NULL; |
| @@ -88,7 +88,7 @@ static void pushobject (lua_State *L, const TValue *o) { | |||
| 88 | #endif | 88 | #endif |
| 89 | 89 | ||
| 90 | 90 | ||
| 91 | Memcontrol memcontrol = {0L, 0L, 0L, 0L}; | 91 | Memcontrol l_memcontrol = {0L, 0L, 0L, 0L}; |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | static void *checkblock (void *block, size_t size) { | 94 | static void *checkblock (void *block, size_t size) { |
| @@ -493,20 +493,20 @@ static int get_limits (lua_State *L) { | |||
| 493 | 493 | ||
| 494 | static int mem_query (lua_State *L) { | 494 | static int mem_query (lua_State *L) { |
| 495 | if (lua_isnone(L, 1)) { | 495 | if (lua_isnone(L, 1)) { |
| 496 | lua_pushinteger(L, memcontrol.total); | 496 | lua_pushinteger(L, l_memcontrol.total); |
| 497 | lua_pushinteger(L, memcontrol.numblocks); | 497 | lua_pushinteger(L, l_memcontrol.numblocks); |
| 498 | lua_pushinteger(L, memcontrol.maxmem); | 498 | lua_pushinteger(L, l_memcontrol.maxmem); |
| 499 | return 3; | 499 | return 3; |
| 500 | } | 500 | } |
| 501 | else { | 501 | else { |
| 502 | memcontrol.memlimit = luaL_checkint(L, 1); | 502 | l_memcontrol.memlimit = luaL_checkint(L, 1); |
| 503 | return 0; | 503 | return 0; |
| 504 | } | 504 | } |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | 507 | ||
| 508 | static int settrick (lua_State *L) { | 508 | static int settrick (lua_State *L) { |
| 509 | Trick = lua_tointeger(L, 1); | 509 | l_Trick = lua_tointeger(L, 1); |
| 510 | return 0; | 510 | return 0; |
| 511 | } | 511 | } |
| 512 | 512 | ||
| @@ -1120,8 +1120,8 @@ static const struct luaL_Reg tests_funcs[] = { | |||
| 1120 | 1120 | ||
| 1121 | 1121 | ||
| 1122 | static void checkfinalmem (void) { | 1122 | static void checkfinalmem (void) { |
| 1123 | lua_assert(memcontrol.numblocks == 0); | 1123 | lua_assert(l_memcontrol.numblocks == 0); |
| 1124 | lua_assert(memcontrol.total == 0); | 1124 | lua_assert(l_memcontrol.total == 0); |
| 1125 | } | 1125 | } |
| 1126 | 1126 | ||
| 1127 | 1127 | ||
| @@ -1129,7 +1129,7 @@ int luaB_opentests (lua_State *L) { | |||
| 1129 | void *ud; | 1129 | void *ud; |
| 1130 | atexit(checkfinalmem); | 1130 | atexit(checkfinalmem); |
| 1131 | lua_assert(lua_getallocf(L, &ud) == debug_realloc); | 1131 | lua_assert(lua_getallocf(L, &ud) == debug_realloc); |
| 1132 | lua_assert(ud == cast(void *, &memcontrol)); | 1132 | lua_assert(ud == cast(void *, &l_memcontrol)); |
| 1133 | lua_setallocf(L, lua_getallocf(L, NULL), ud); | 1133 | lua_setallocf(L, lua_getallocf(L, NULL), ud); |
| 1134 | lua_state = L; /* keep first state to be opened */ | 1134 | lua_state = L; /* keep first state to be opened */ |
| 1135 | luaL_register(L, "T", tests_funcs); | 1135 | luaL_register(L, "T", tests_funcs); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.h,v 2.18 2006/06/05 19:35:57 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 2.19 2007/09/30 13:09:43 roberto Exp roberto $ |
| 3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -30,19 +30,19 @@ typedef struct Memcontrol { | |||
| 30 | unsigned long memlimit; | 30 | unsigned long memlimit; |
| 31 | } Memcontrol; | 31 | } Memcontrol; |
| 32 | 32 | ||
| 33 | LUAI_DATA Memcontrol memcontrol; | 33 | LUAI_DATA Memcontrol l_memcontrol; |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | /* | 36 | /* |
| 37 | ** generic variable for debug tricks | 37 | ** generic variable for debug tricks |
| 38 | */ | 38 | */ |
| 39 | LUAI_DATA int Trick; | 39 | LUAI_DATA int l_Trick; |
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize); | 42 | void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize); |
| 43 | 43 | ||
| 44 | #ifdef lua_c | 44 | #ifdef lua_c |
| 45 | #define luaL_newstate() lua_newstate(debug_realloc, &memcontrol) | 45 | #define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol) |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | 48 | ||
