diff options
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -114,13 +114,8 @@ LUA_API int lua_checkstack (lua_State *L, int n) { | |||
114 | api_check(L, n >= 0, "negative 'n'"); | 114 | api_check(L, n >= 0, "negative 'n'"); |
115 | if (L->stack_last - L->top > n) /* stack large enough? */ | 115 | if (L->stack_last - L->top > n) /* stack large enough? */ |
116 | res = 1; /* yes; check is OK */ | 116 | res = 1; /* yes; check is OK */ |
117 | else { /* no; need to grow stack */ | 117 | else /* need to grow stack */ |
118 | int inuse = cast_int(L->top - L->stack) + EXTRA_STACK; | 118 | res = luaD_growstack(L, n, 0); |
119 | if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */ | ||
120 | res = 0; /* no */ | ||
121 | else /* try to grow stack */ | ||
122 | res = luaD_growstack(L, n, 0); | ||
123 | } | ||
124 | if (res && ci->top < L->top + n) | 119 | if (res && ci->top < L->top + n) |
125 | ci->top = L->top + n; /* adjust frame top */ | 120 | ci->top = L->top + n; /* adjust frame top */ |
126 | lua_unlock(L); | 121 | lua_unlock(L); |