| 189 | |
| 190 | |
| 191 | void luaD_growstack (lua_State *L, int n) { |
| 192 | int size = L->stacksize; |
| 193 | if (size > LUAI_MAXSTACK) /* error after extra size? */ |
| 194 | luaD_throw(L, LUA_ERRERR); |
| 195 | else { |
| 196 | int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK; |
| 197 | int newsize = 2 * size; |
| 198 | if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; |
| 199 | if (newsize < needed) newsize = needed; |
| 200 | if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ |
| 201 | luaD_reallocstack(L, ERRORSTACKSIZE); |
| 202 | luaG_runerror(L, "stack overflow"); |
| 203 | } |
| 204 | else |
| 205 | luaD_reallocstack(L, newsize); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | |
| 210 | static int stackinuse (lua_State *L) { |
no test coverage detected