diff options
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 1.112 2002/11/18 11:01:55 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.113 2002/11/19 14:12:13 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -84,8 +84,9 @@ static void freestack (lua_State *L, lua_State *L1) { | |||
84 | */ | 84 | */ |
85 | static void f_luaopen (lua_State *L, void *ud) { | 85 | static void f_luaopen (lua_State *L, void *ud) { |
86 | /* create a new global state */ | 86 | /* create a new global state */ |
87 | global_State *g = luaM_new(L, global_State); | 87 | global_State *g = luaM_new(NULL, global_State); |
88 | UNUSED(ud); | 88 | UNUSED(ud); |
89 | if (g == NULL) luaD_throw(L, LUA_ERRMEM); | ||
89 | L->l_G = g; | 90 | L->l_G = g; |
90 | g->mainthread = L; | 91 | g->mainthread = L; |
91 | g->GCthreshold = 0; /* mark it as unfinished state */ | 92 | g->GCthreshold = 0; /* mark it as unfinished state */ |
@@ -147,7 +148,7 @@ static void close_state (lua_State *L) { | |||
147 | freestack(L, L); | 148 | freestack(L, L); |
148 | if (G(L)) { | 149 | if (G(L)) { |
149 | lua_assert(G(L)->nblocks == sizeof(lua_State) + sizeof(global_State)); | 150 | lua_assert(G(L)->nblocks == sizeof(lua_State) + sizeof(global_State)); |
150 | luaM_freelem(L, G(L)); | 151 | luaM_freelem(NULL, G(L)); |
151 | } | 152 | } |
152 | freestate(NULL, L); | 153 | freestate(NULL, L); |
153 | } | 154 | } |