diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-14 14:46:07 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-14 14:46:07 -0300 |
| commit | f555e493f0a12513f79f999ceed5467085b1c9c4 (patch) | |
| tree | 1168138080c0d2a5e1574709f1055ce0b9aaf4c3 /lstate.c | |
| parent | d1ffd1a1c5639d6ad84b695d3c6dae9e37830a0b (diff) | |
| download | lua-f555e493f0a12513f79f999ceed5467085b1c9c4.tar.gz lua-f555e493f0a12513f79f999ceed5467085b1c9c4.tar.bz2 lua-f555e493f0a12513f79f999ceed5467085b1c9c4.zip | |
lua_state may not exist
Diffstat (limited to 'lstate.c')
| -rw-r--r-- | lstate.c | 11 |
1 files changed, 5 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 1.31 2000/08/08 20:42:07 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.32 2000/08/09 19:16:57 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 | */ |
| @@ -70,7 +70,9 @@ lua_State *lua_newstate (int stacksize, int put_builtin) { | |||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | 72 | ||
| 73 | #ifdef DEBUG | ||
| 73 | extern lua_State *lua_state; | 74 | extern lua_State *lua_state; |
| 75 | #endif | ||
| 74 | 76 | ||
| 75 | void lua_close (lua_State *L) { | 77 | void lua_close (lua_State *L) { |
| 76 | luaC_collect(L, 1); /* collect all elements */ | 78 | luaC_collect(L, 1); /* collect all elements */ |
| @@ -86,10 +88,7 @@ void lua_close (lua_State *L) { | |||
| 86 | LUA_ASSERT(L->numCblocks == 0, "Cblocks still open"); | 88 | LUA_ASSERT(L->numCblocks == 0, "Cblocks still open"); |
| 87 | LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks"); | 89 | LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks"); |
| 88 | luaM_free(L, L); | 90 | luaM_free(L, L); |
| 89 | if (L == lua_state) { | 91 | LUA_ASSERT(L != lua_state || memdebug_numblocks == 0, "memory leak!"); |
| 90 | LUA_ASSERT(memdebug_numblocks == 0, "memory leak!"); | 92 | LUA_ASSERT(L != lua_state || memdebug_total == 0,"memory leak!"); |
| 91 | LUA_ASSERT(memdebug_total == 0,"memory leak!"); | ||
| 92 | lua_state = NULL; | ||
| 93 | } | ||
| 94 | } | 93 | } |
| 95 | 94 | ||
