MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaM_realloc_

Function luaM_realloc_

third-party/lua-5.4.6/src/lmem.c:176–189  ·  view source on GitHub ↗

** Generic allocation routine. */

Source from the content-addressed store, hash-verified

174** Generic allocation routine.
175*/
176void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
177 void *newblock;
178 global_State *g = G(L);
179 lua_assert((osize == 0) == (block == NULL));
180 newblock = firsttry(g, block, osize, nsize);
181 if (l_unlikely(newblock == NULL && nsize > 0)) {
182 newblock = tryagain(L, block, osize, nsize);
183 if (newblock == NULL) /* still no memory? */
184 return NULL; /* do not update 'GCdebt' */
185 }
186 lua_assert((nsize == 0) == (newblock == NULL));
187 g->GCdebt = (g->GCdebt + nsize) - osize;
188 return newblock;
189}
190
191
192void *luaM_saferealloc_ (lua_State *L, void *block, size_t osize,

Callers 1

luaM_saferealloc_Function · 0.70

Calls 2

firsttryFunction · 0.70
tryagainFunction · 0.70

Tested by

no test coverage detected