MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / luaM_realloc_

Function luaM_realloc_

lua/src/lmem.c:162–175  ·  view source on GitHub ↗

** Generic allocation routine. */

Source from the content-addressed store, hash-verified

160** Generic allocation routine.
161*/
162void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
163 void *newblock;
164 global_State *g = G(L);
165 lua_assert((osize == 0) == (block == NULL));
166 newblock = firsttry(g, block, osize, nsize);
167 if (l_unlikely(newblock == NULL && nsize > 0)) {
168 newblock = tryagain(L, block, osize, nsize);
169 if (newblock == NULL) /* still no memory? */
170 return NULL; /* do not update 'GCdebt' */
171 }
172 lua_assert((nsize == 0) == (newblock == NULL));
173 g->GCdebt = (g->GCdebt + nsize) - osize;
174 return newblock;
175}
176
177
178void *luaM_saferealloc_ (lua_State *L, void *block, size_t osize,

Callers 1

luaM_saferealloc_Function · 0.85

Calls 2

firsttryFunction · 0.85
tryagainFunction · 0.85

Tested by

no test coverage detected