use prefix in extern names, even those in test files

This commit is contained in:
Roberto Ierusalimschy 2007-11-12 14:28:45 -02:00
parent 788506dd58
commit 658e7caf92
2 changed files with 15 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: ltests.c,v 2.42 2007/04/17 13:19:53 roberto Exp roberto $
** $Id: ltests.c,v 2.43 2007/06/21 13:48:04 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@ -37,7 +37,7 @@
#if defined(LUA_DEBUG)
int Trick = 0;
int l_Trick = 0;
static lua_State *lua_state = NULL;
@ -88,7 +88,7 @@ static void pushobject (lua_State *L, const TValue *o) {
#endif
Memcontrol memcontrol = {0L, 0L, 0L, 0L};
Memcontrol l_memcontrol = {0L, 0L, 0L, 0L};
static void *checkblock (void *block, size_t size) {
@ -493,20 +493,20 @@ static int get_limits (lua_State *L) {
static int mem_query (lua_State *L) {
if (lua_isnone(L, 1)) {
lua_pushinteger(L, memcontrol.total);
lua_pushinteger(L, memcontrol.numblocks);
lua_pushinteger(L, memcontrol.maxmem);
lua_pushinteger(L, l_memcontrol.total);
lua_pushinteger(L, l_memcontrol.numblocks);
lua_pushinteger(L, l_memcontrol.maxmem);
return 3;
}
else {
memcontrol.memlimit = luaL_checkint(L, 1);
l_memcontrol.memlimit = luaL_checkint(L, 1);
return 0;
}
}
static int settrick (lua_State *L) {
Trick = lua_tointeger(L, 1);
l_Trick = lua_tointeger(L, 1);
return 0;
}
@ -1120,8 +1120,8 @@ static const struct luaL_Reg tests_funcs[] = {
static void checkfinalmem (void) {
lua_assert(memcontrol.numblocks == 0);
lua_assert(memcontrol.total == 0);
lua_assert(l_memcontrol.numblocks == 0);
lua_assert(l_memcontrol.total == 0);
}
@ -1129,7 +1129,7 @@ int luaB_opentests (lua_State *L) {
void *ud;
atexit(checkfinalmem);
lua_assert(lua_getallocf(L, &ud) == debug_realloc);
lua_assert(ud == cast(void *, &memcontrol));
lua_assert(ud == cast(void *, &l_memcontrol));
lua_setallocf(L, lua_getallocf(L, NULL), ud);
lua_state = L; /* keep first state to be opened */
luaL_register(L, "T", tests_funcs);

View File

@ -1,5 +1,5 @@
/*
** $Id: ltests.h,v 2.18 2006/06/05 19:35:57 roberto Exp roberto $
** $Id: ltests.h,v 2.19 2007/09/30 13:09:43 roberto Exp roberto $
** Internal Header for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@ -30,19 +30,19 @@ typedef struct Memcontrol {
unsigned long memlimit;
} Memcontrol;
LUAI_DATA Memcontrol memcontrol;
LUAI_DATA Memcontrol l_memcontrol;
/*
** generic variable for debug tricks
*/
LUAI_DATA int Trick;
LUAI_DATA int l_Trick;
void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize);
#ifdef lua_c
#define luaL_newstate() lua_newstate(debug_realloc, &memcontrol)
#define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol)
#endif