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