summaryrefslogtreecommitdiff
path: root/lib/lua/src/lapi.c
diff options
context:
space:
mode:
authorpixel <pixel>2008-02-18 10:15:45 +0000
committerpixel <pixel>2008-02-18 10:15:45 +0000
commit11d24fff6bbda7fd295b035d79da9f29725f0e1f (patch)
tree7bd713e6d3efeecdf813d4889fd488ad137bb143 /lib/lua/src/lapi.c
parentca1522e3cb60c8f45483be92af19982ded77676d (diff)
Patching latests lua bug reports.
Diffstat (limited to 'lib/lua/src/lapi.c')
-rw-r--r--lib/lua/src/lapi.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/lua/src/lapi.c b/lib/lua/src/lapi.c
index 849c724..32421e3 100644
--- a/lib/lua/src/lapi.c
+++ b/lib/lua/src/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 1.7 2008-02-17 00:35:20 pixel Exp $
+** $Id: lapi.c,v 1.8 2008-02-18 10:15:45 pixel 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;