summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2008-06-26 16:40:12 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2008-06-26 16:40:12 -0300
commit1527d8f00d4a99997cf73f50fe159ddba8681f8f (patch)
tree88606a3615006a1d740943dc1836a834c85f1e55 /lua.c
parent8efaf8af81ec1daf7a9881373d08a01fc2dc72e4 (diff)
downloadlua-1527d8f00d4a99997cf73f50fe159ddba8681f8f.tar.gz
lua-1527d8f00d4a99997cf73f50fe159ddba8681f8f.tar.bz2
lua-1527d8f00d4a99997cf73f50fe159ddba8681f8f.zip
GC called after errors now are called after showing error message (to
avoid problems when there are other errors during GC itself)
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lua.c b/lua.c
index dec5612d..b0d73a13 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.167 2007/08/07 16:53:40 roberto Exp roberto $ 2** $Id: lua.c,v 1.168 2007/09/05 17:17:39 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -68,6 +68,8 @@ static int report (lua_State *L, int status) {
68 if (msg == NULL) msg = "(error object is not a string)"; 68 if (msg == NULL) msg = "(error object is not a string)";
69 l_message(progname, msg); 69 l_message(progname, msg);
70 lua_pop(L, 1); 70 lua_pop(L, 1);
71 /* force a complete garbage collection in case of errors */
72 lua_gc(L, LUA_GCCOLLECT, 0);
71 } 73 }
72 return status; 74 return status;
73} 75}
@@ -95,8 +97,6 @@ static int docall (lua_State *L, int narg, int clear) {
95 status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); 97 status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
96 signal(SIGINT, SIG_DFL); 98 signal(SIGINT, SIG_DFL);
97 lua_remove(L, base); /* remove traceback function */ 99 lua_remove(L, base); /* remove traceback function */
98 /* force a complete garbage collection in case of errors */
99 if (status != LUA_OK) lua_gc(L, LUA_GCCOLLECT, 0);
100 return status; 100 return status;
101} 101}
102 102