| 239 | |
| 240 | |
| 241 | static void checkstacksizes (lua_State *L, StkId max) { |
| 242 | int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ |
| 243 | int s_used = cast_int(max - L->stack); /* part of stack in use */ |
| 244 | if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ |
| 245 | return; /* do not touch the stacks */ |
| 246 | if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) |
| 247 | luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ |
| 248 | condhardstacktests(luaD_reallocCI(L, ci_used + 1)); |
| 249 | if (4*s_used < L->stacksize && |
| 250 | 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize) |
| 251 | luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ |
| 252 | condhardstacktests(luaD_reallocstack(L, s_used)); |
| 253 | } |
| 254 | |
| 255 | |
| 256 | static void traversestack (global_State *g, lua_State *l) { |
no test coverage detected