From e962330df9311515cf414097cd077ab93a928089 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 26 Nov 1997 18:28:22 -0200 Subject: "stacklimit" is not necessary. --- ldo.c | 14 +++++--------- lstate.h | 3 +-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ldo.c b/ldo.c index a50d9da3..5b03633f 100644 --- a/ldo.c +++ b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 1.9 1997/11/19 17:29:23 roberto Exp roberto $ +** $Id: ldo.c,v 1.10 1997/11/21 19:00:46 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -58,7 +58,6 @@ static void initCfunc (TObject *o, lua_CFunction f) void luaD_init (void) { - L->stacklimit = STACK_LIMIT; L->stack.stack = luaM_newvector(INIT_STACK_SIZE, TObject); L->stack.top = L->stack.stack; L->stack.last = L->stack.stack+(INIT_STACK_SIZE-1); @@ -71,16 +70,13 @@ void luaD_checkstack (int n) if (L->stack.last-L->stack.top <= n) { StkId top = L->stack.top-L->stack.stack; int stacksize = (L->stack.last-L->stack.stack)+1+STACK_EXTRA+n; - L->stack.stack = luaM_reallocvector(L->stack.stack, stacksize,TObject); + L->stack.stack = luaM_reallocvector(L->stack.stack, stacksize, TObject); L->stack.last = L->stack.stack+(stacksize-1); L->stack.top = L->stack.stack + top; - if (stacksize >= L->stacklimit) { - /* extra space to run error handler */ - L->stacklimit = stacksize+STACK_EXTRA; - if (lua_stackedfunction(100) == LUA_NOOBJECT) { - /* less than 100 functions on the stack: cannot be recursive loop */ + if (stacksize >= STACK_LIMIT) { + if (lua_stackedfunction(100) == LUA_NOOBJECT) + /* doesn't look like a recursive loop */ lua_error("Lua2C - C2Lua overflow"); - } else lua_error(stackEM); } diff --git a/lstate.h b/lstate.h index dc3a456b..83117949 100644 --- a/lstate.h +++ b/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 1.1 1997/11/19 17:30:36 roberto Exp roberto $ +** $Id: lstate.h,v 1.2 1997/11/21 19:00:46 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -47,7 +47,6 @@ struct ref { typedef struct LState { struct Stack stack; /* Lua stack */ struct C_Lua_Stack Cstack; /* C2lua struct */ - int stacklimit; /* limit for stack overflow */ void *errorJmp; /* current error recover point */ TObject errorim; /* error tag method */ struct C_Lua_Stack Cblocks[MAX_C_BLOCKS]; -- cgit v1.2.3-55-g6feb