mirror of
https://github.com/lua/lua.git
synced 2025-01-28 06:03:00 +08:00
"stacklimit" is not necessary.
This commit is contained in:
parent
b291e50006
commit
e962330df9
14
ldo.c
14
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);
|
||||
}
|
||||
|
3
lstate.h
3
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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user