diff options
author | Lua Team <team@lua.org> | 2011-11-24 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2011-11-24 12:00:00 +0000 |
commit | 2e5ae8240bb2daf5d66d69e199de10dde62f5d13 (patch) | |
tree | b9f21bdd5006c59adc99000afa3cf22da8ea1c57 /src/lstate.c | |
parent | c17c598e967843fa77a465caf0e0df15d9019409 (diff) | |
download | lua-github-5.2.0-rc1.tar.gz |
Lua 5.2.0-rc15.2.0-rc1
Diffstat (limited to 'src/lstate.c')
-rw-r--r-- | src/lstate.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lstate.c b/src/lstate.c index 45dac3c5..6e2801c4 100644 --- a/src/lstate.c +++ b/src/lstate.c @@ -1,5 +1,5 @@ /* -** $Id: lstate.c,v 2.89 2010/12/20 19:40:07 roberto Exp $ +** $Id: lstate.c,v 2.92 2011/10/03 17:54:25 roberto Exp $ ** Global State ** See Copyright Notice in lua.h */ @@ -136,10 +136,10 @@ static void init_registry (lua_State *L, global_State *g) { luaH_resize(L, registry, LUA_RIDX_LAST, 0); /* registry[LUA_RIDX_MAINTHREAD] = L */ setthvalue(L, &mt, L); - setobj2t(L, luaH_setint(L, registry, LUA_RIDX_MAINTHREAD), &mt); + luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &mt); /* registry[LUA_RIDX_GLOBALS] = table of globals */ sethvalue(L, &mt, luaH_new(L)); - setobj2t(L, luaH_setint(L, registry, LUA_RIDX_GLOBALS), &mt); + luaH_setint(L, registry, LUA_RIDX_GLOBALS, &mt); } @@ -171,6 +171,7 @@ static void preinit_state (lua_State *L, global_State *g) { L->ci = NULL; L->stacksize = 0; L->errorJmp = NULL; + L->nCcalls = 0; L->hook = NULL; L->hookmask = 0; L->basehookcount = 0; @@ -191,7 +192,7 @@ static void close_state (lua_State *L) { luaZ_freebuffer(L, &g->buff); freestack(L); lua_assert(gettotalbytes(g) == sizeof(LG)); - (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); + (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ } @@ -237,7 +238,6 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); L->marked = luaC_white(g); g->gckind = KGC_NORMAL; - g->nCcalls = 0; preinit_state(L, g); g->frealloc = f; g->ud = ud; @@ -279,9 +279,6 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { LUA_API void lua_close (lua_State *L) { L = G(L)->mainthread; /* only the main thread can be closed */ lua_lock(L); - luaF_close(L, L->stack); /* close all upvalues for this thread */ - luaC_separateudata(L, 1); /* separate all udata with GC metamethods */ - lua_assert(L->next == NULL); luai_userstateclose(L); close_state(L); } |