"stacklimit" is not necessary.
This commit is contained in:
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
|
** Stack and Call structure of Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -58,7 +58,6 @@ static void initCfunc (TObject *o, lua_CFunction f)
|
|||||||
|
|
||||||
void luaD_init (void)
|
void luaD_init (void)
|
||||||
{
|
{
|
||||||
L->stacklimit = STACK_LIMIT;
|
|
||||||
L->stack.stack = luaM_newvector(INIT_STACK_SIZE, TObject);
|
L->stack.stack = luaM_newvector(INIT_STACK_SIZE, TObject);
|
||||||
L->stack.top = L->stack.stack;
|
L->stack.top = L->stack.stack;
|
||||||
L->stack.last = L->stack.stack+(INIT_STACK_SIZE-1);
|
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) {
|
if (L->stack.last-L->stack.top <= n) {
|
||||||
StkId top = L->stack.top-L->stack.stack;
|
StkId top = L->stack.top-L->stack.stack;
|
||||||
int stacksize = (L->stack.last-L->stack.stack)+1+STACK_EXTRA+n;
|
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.last = L->stack.stack+(stacksize-1);
|
||||||
L->stack.top = L->stack.stack + top;
|
L->stack.top = L->stack.stack + top;
|
||||||
if (stacksize >= L->stacklimit) {
|
if (stacksize >= STACK_LIMIT) {
|
||||||
/* extra space to run error handler */
|
if (lua_stackedfunction(100) == LUA_NOOBJECT)
|
||||||
L->stacklimit = stacksize+STACK_EXTRA;
|
/* doesn't look like a recursive loop */
|
||||||
if (lua_stackedfunction(100) == LUA_NOOBJECT) {
|
|
||||||
/* less than 100 functions on the stack: cannot be recursive loop */
|
|
||||||
lua_error("Lua2C - C2Lua overflow");
|
lua_error("Lua2C - C2Lua overflow");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
lua_error(stackEM);
|
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
|
** Global State
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -47,7 +47,6 @@ struct ref {
|
|||||||
typedef struct LState {
|
typedef struct LState {
|
||||||
struct Stack stack; /* Lua stack */
|
struct Stack stack; /* Lua stack */
|
||||||
struct C_Lua_Stack Cstack; /* C2lua struct */
|
struct C_Lua_Stack Cstack; /* C2lua struct */
|
||||||
int stacklimit; /* limit for stack overflow */
|
|
||||||
void *errorJmp; /* current error recover point */
|
void *errorJmp; /* current error recover point */
|
||||||
TObject errorim; /* error tag method */
|
TObject errorim; /* error tag method */
|
||||||
struct C_Lua_Stack Cblocks[MAX_C_BLOCKS];
|
struct C_Lua_Stack Cblocks[MAX_C_BLOCKS];
|
||||||
|
|||||||
Reference in New Issue
Block a user