diff options
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.9 1997/11/19 17:29:23 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.10 1997/11/21 19:00:46 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -58,7 +58,6 @@ static void initCfunc (TObject *o, lua_CFunction f) | |||
58 | 58 | ||
59 | void luaD_init (void) | 59 | void luaD_init (void) |
60 | { | 60 | { |
61 | L->stacklimit = STACK_LIMIT; | ||
62 | L->stack.stack = luaM_newvector(INIT_STACK_SIZE, TObject); | 61 | L->stack.stack = luaM_newvector(INIT_STACK_SIZE, TObject); |
63 | L->stack.top = L->stack.stack; | 62 | L->stack.top = L->stack.stack; |
64 | L->stack.last = L->stack.stack+(INIT_STACK_SIZE-1); | 63 | L->stack.last = L->stack.stack+(INIT_STACK_SIZE-1); |
@@ -71,16 +70,13 @@ void luaD_checkstack (int n) | |||
71 | if (L->stack.last-L->stack.top <= n) { | 70 | if (L->stack.last-L->stack.top <= n) { |
72 | StkId top = L->stack.top-L->stack.stack; | 71 | StkId top = L->stack.top-L->stack.stack; |
73 | int stacksize = (L->stack.last-L->stack.stack)+1+STACK_EXTRA+n; | 72 | int stacksize = (L->stack.last-L->stack.stack)+1+STACK_EXTRA+n; |
74 | L->stack.stack = luaM_reallocvector(L->stack.stack, stacksize,TObject); | 73 | L->stack.stack = luaM_reallocvector(L->stack.stack, stacksize, TObject); |
75 | L->stack.last = L->stack.stack+(stacksize-1); | 74 | L->stack.last = L->stack.stack+(stacksize-1); |
76 | L->stack.top = L->stack.stack + top; | 75 | L->stack.top = L->stack.stack + top; |
77 | if (stacksize >= L->stacklimit) { | 76 | if (stacksize >= STACK_LIMIT) { |
78 | /* extra space to run error handler */ | 77 | if (lua_stackedfunction(100) == LUA_NOOBJECT) |
79 | L->stacklimit = stacksize+STACK_EXTRA; | 78 | /* doesn't look like a recursive loop */ |
80 | if (lua_stackedfunction(100) == LUA_NOOBJECT) { | ||
81 | /* less than 100 functions on the stack: cannot be recursive loop */ | ||
82 | lua_error("Lua2C - C2Lua overflow"); | 79 | lua_error("Lua2C - C2Lua overflow"); |
83 | } | ||
84 | else | 80 | else |
85 | lua_error(stackEM); | 81 | lua_error(stackEM); |
86 | } | 82 | } |