summaryrefslogtreecommitdiff
path: root/src/lapi.c
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2008-08-12 12:00:00 +0000
committerrepogen <>2008-08-12 12:00:00 +0000
commit22486e05cc9d1a6b207504e037de512240c0432f (patch)
treee1b29dc03c497c069b5360101e924850fba6aec2 /src/lapi.c
parent52441b3df3a2448a8a30548a19601c6fc5689934 (diff)
downloadlua-github-5.1.4-rc1.tar.gz
Lua 5.1.4-rc15.1.4-rc1
Diffstat (limited to 'src/lapi.c')
-rw-r--r--src/lapi.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lapi.c b/src/lapi.c
index d7e8931e..5d5145d2 100644
--- a/src/lapi.c
+++ b/src/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 2.55.1.3 2008/01/03 15:20:39 roberto Exp $
+** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -93,15 +93,14 @@ void luaA_pushobject (lua_State *L, const TValue *o) {
LUA_API int lua_checkstack (lua_State *L, int size) {
- int res;
+ int res = 1;
lua_lock(L);
- if ((L->top - L->base + size) > LUAI_MAXCSTACK)
+ if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK)
res = 0; /* stack overflow */
- else {
+ else if (size > 0) {
luaD_checkstack(L, size);
if (L->ci->top < L->top + size)
L->ci->top = L->top + size;
- res = 1;
}
lua_unlock(L);
return res;
@@ -930,10 +929,13 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
g->GCthreshold = g->totalbytes - a;
else
g->GCthreshold = 0;
- while (g->GCthreshold <= g->totalbytes)
+ while (g->GCthreshold <= g->totalbytes) {
luaC_step(L);
- if (g->gcstate == GCSpause) /* end of cycle? */
- res = 1; /* signal it */
+ if (g->gcstate == GCSpause) { /* end of cycle? */
+ res = 1; /* signal it */
+ break;
+ }
+ }
break;
}
case LUA_GCSETPAUSE: {