diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-10-14 15:53:35 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-10-14 15:53:35 -0200 |
| commit | b6ebbb2fee13aa223fdd12921cd0411e02db9dd0 (patch) | |
| tree | 03320716aa1cb444e50981dbfea93a89f2cea5cb /lstate.c | |
| parent | c5fee7615e979e3a39af44614f82938519dedb68 (diff) | |
| download | lua-b6ebbb2fee13aa223fdd12921cd0411e02db9dd0.tar.gz lua-b6ebbb2fee13aa223fdd12921cd0411e02db9dd0.tar.bz2 lua-b6ebbb2fee13aa223fdd12921cd0411e02db9dd0.zip | |
better assertions.
Diffstat (limited to 'lstate.c')
| -rw-r--r-- | lstate.c | 12 |
1 files changed, 7 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 1.13 1999/08/16 20:52:00 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.14 1999/10/04 17:51:04 roberto Exp $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -53,6 +53,10 @@ void lua_open (void) { | |||
| 53 | 53 | ||
| 54 | void lua_close (void) { | 54 | void lua_close (void) { |
| 55 | luaC_collect(1); /* collect all elements */ | 55 | luaC_collect(1); /* collect all elements */ |
| 56 | LUA_ASSERT(L->rootproto == NULL, "list should be empty"); | ||
| 57 | LUA_ASSERT(L->rootcl == NULL, "list should be empty"); | ||
| 58 | LUA_ASSERT(L->rootglobal == NULL, "list should be empty"); | ||
| 59 | LUA_ASSERT(L->roottable == NULL, "list should be empty"); | ||
| 56 | luaS_freeall(); | 60 | luaS_freeall(); |
| 57 | luaM_free(L->stack.stack); | 61 | luaM_free(L->stack.stack); |
| 58 | luaM_free(L->IMtable); | 62 | luaM_free(L->IMtable); |
| @@ -61,11 +65,9 @@ void lua_close (void) { | |||
| 61 | luaM_free(L->Cblocks); | 65 | luaM_free(L->Cblocks); |
| 62 | LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks"); | 66 | LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks"); |
| 63 | luaM_free(L); | 67 | luaM_free(L); |
| 68 | LUA_ASSERT(numblocks == 0, "memory leak!"); | ||
| 69 | LUA_ASSERT(totalmem == 0,"memory leak!"); | ||
| 64 | L = NULL; | 70 | L = NULL; |
| 65 | #ifdef DEBUG | ||
| 66 | printf("total de blocos: %ld\n", numblocks); | ||
| 67 | printf("total de memoria: %ld\n", totalmem); | ||
| 68 | #endif | ||
| 69 | } | 71 | } |
| 70 | 72 | ||
| 71 | 73 | ||
