| 198 | |
| 199 | |
| 200 | void luaD_growstack (lua_State *L, int n) { |
| 201 | int size = L->stacksize; |
| 202 | if (size > LUAI_MAXSTACK) /* error after extra size? */ |
| 203 | luaD_throw(L, LUA_ERRERR); |
| 204 | else { |
| 205 | int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK; |
| 206 | int newsize = 2 * size; |
| 207 | if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; |
| 208 | if (newsize < needed) newsize = needed; |
| 209 | if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ |
| 210 | luaD_reallocstack(L, ERRORSTACKSIZE); |
| 211 | luaG_runerror(L, "stack overflow"); |
| 212 | } |
| 213 | else |
| 214 | luaD_reallocstack(L, newsize); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | |
| 219 | static int stackinuse (lua_State *L) { |
no test coverage detected