better assertions.
This commit is contained in:
3
ldo.c
3
ldo.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ldo.c,v 1.47 1999/09/06 15:24:46 roberto Exp roberto $
|
** $Id: ldo.c,v 1.48 1999/10/04 17:51:04 roberto Exp roberto $
|
||||||
** Stack and Call structure of Lua
|
** Stack and Call structure of Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -236,6 +236,7 @@ void lua_error (const char *s) {
|
|||||||
if (L->errorJmp)
|
if (L->errorJmp)
|
||||||
longjmp(L->errorJmp->b, 1);
|
longjmp(L->errorJmp->b, 1);
|
||||||
else {
|
else {
|
||||||
|
LUA_INTERNALERROR("exit!!");
|
||||||
message("exit(1). Unable to recover.\n");
|
message("exit(1). Unable to recover.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
12
lstate.c
12
lstate.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lstate.c,v 1.13 1999/08/16 20:52:00 roberto Exp roberto $
|
** $Id: lstate.c,v 1.14 1999/10/04 17:51:04 roberto Exp $
|
||||||
** Global State
|
** Global State
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -53,6 +53,10 @@ void lua_open (void) {
|
|||||||
|
|
||||||
void lua_close (void) {
|
void lua_close (void) {
|
||||||
luaC_collect(1); /* collect all elements */
|
luaC_collect(1); /* collect all elements */
|
||||||
|
LUA_ASSERT(L->rootproto == NULL, "list should be empty");
|
||||||
|
LUA_ASSERT(L->rootcl == NULL, "list should be empty");
|
||||||
|
LUA_ASSERT(L->rootglobal == NULL, "list should be empty");
|
||||||
|
LUA_ASSERT(L->roottable == NULL, "list should be empty");
|
||||||
luaS_freeall();
|
luaS_freeall();
|
||||||
luaM_free(L->stack.stack);
|
luaM_free(L->stack.stack);
|
||||||
luaM_free(L->IMtable);
|
luaM_free(L->IMtable);
|
||||||
@@ -61,11 +65,9 @@ void lua_close (void) {
|
|||||||
luaM_free(L->Cblocks);
|
luaM_free(L->Cblocks);
|
||||||
LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks");
|
LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks");
|
||||||
luaM_free(L);
|
luaM_free(L);
|
||||||
|
LUA_ASSERT(numblocks == 0, "memory leak!");
|
||||||
|
LUA_ASSERT(totalmem == 0,"memory leak!");
|
||||||
L = NULL;
|
L = NULL;
|
||||||
#ifdef DEBUG
|
|
||||||
printf("total de blocos: %ld\n", numblocks);
|
|
||||||
printf("total de memoria: %ld\n", totalmem);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user