simpler way to control stack overflow

This commit is contained in:
Roberto Ierusalimschy
2002-03-26 17:46:10 -03:00
parent 0b9b53e21c
commit 81215cd59f
4 changed files with 51 additions and 44 deletions

4
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 1.178 2002/03/18 20:11:52 roberto Exp roberto $
** $Id: lapi.c,v 1.179 2002/03/20 12:51:29 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -85,7 +85,7 @@ void luaA_pushobject (lua_State *L, const TObject *o) {
LUA_API int lua_checkstack (lua_State *L, int size) {
int res;
lua_lock(L);
if ((L->top - L->stack) >= LUA_MAXSTACK - size)
if ((L->top - L->ci->base + size) > LUA_MAXCSTACK)
res = 0; /* stack overflow */
else {
luaD_checkstack(L, size);