MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaD_reallocstack

Function luaD_reallocstack

extlibs/lua/src/ldo.c:185–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183
184
185int luaD_reallocstack (lua_State *L, int newsize, int raiseerror) {
186 int lim = L->stacksize;
187 StkId newstack = luaM_reallocvector(L, L->stack, lim, newsize, StackValue);
188 lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE);
189 lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK);
190 if (unlikely(newstack == NULL)) { /* reallocation failed? */
191 if (raiseerror)
192 luaM_error(L);
193 else return 0; /* do not raise an error */
194 }
195 for (; lim < newsize; lim++)
196 setnilvalue(s2v(newstack + lim)); /* erase new segment */
197 correctstack(L, L->stack, newstack);
198 L->stack = newstack;
199 L->stacksize = newsize;
200 L->stack_last = L->stack + newsize - EXTRA_STACK;
201 return 1;
202}
203
204
205/*

Callers 2

luaD_growstackFunction · 0.85
luaD_shrinkstackFunction · 0.85

Calls 1

correctstackFunction · 0.85

Tested by

no test coverage detected