BUG: there is only one C stack, so nCcalls must be global

This commit is contained in:
Roberto Ierusalimschy
2006-08-15 16:59:20 -03:00
parent dfe2f1eeff
commit 93bf618504
4 changed files with 32 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lstate.c,v 2.36 2006/05/24 14:15:50 roberto Exp roberto $
** $Id: lstate.c,v 2.37 2006/07/11 15:53:29 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@@ -94,7 +94,7 @@ static void preinit_state (lua_State *L, global_State *g) {
resethookcount(L);
L->openupval = NULL;
L->size_ci = 0;
L->nCcalls = 0;
L->baseCcalls = 0;
L->status = 0;
L->base_ci = L->ci = NULL;
L->savedpc = NULL;
@@ -161,6 +161,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT);
L->marked = luaC_white(g);
g->emergencygc = 0;
g->nCcalls = 0;
set2bits(L->marked, FIXEDBIT, SFIXEDBIT);
preinit_state(L, g);
g->frealloc = f;
@@ -214,7 +215,7 @@ LUA_API void lua_close (lua_State *L) {
do { /* repeat until no more errors */
L->ci = L->base_ci;
L->base = L->top = L->ci->base;
L->nCcalls = 0;
G(L)->nCcalls = 0;
} while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0);
lua_assert(G(L)->tmudata == NULL);
luai_userstateclose(L);