| 243 | |
| 244 | |
| 245 | void luaD_growstack (lua_State *L, int n) { |
| 246 | int size = L->stacksize; |
| 247 | if (size > LUAI_MAXSTACK) /* error after extra size? */ |
| 248 | luaD_throw(L, LUA_ERRERR); |
| 249 | else { |
| 250 | int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK; |
| 251 | int newsize = 2 * size; |
| 252 | if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; |
| 253 | if (newsize < needed) newsize = needed; |
| 254 | if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ |
| 255 | luaD_reallocstack(L, ERRORSTACKSIZE); |
| 256 | luaG_runerror(L, "stack overflow"); |
| 257 | } |
| 258 | else |
| 259 | luaD_reallocstack(L, newsize); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | |
| 264 | static int stackinuse (lua_State *L) { |
no test coverage detected