MCPcopy Create free account
hub / github.com/DFHack/dfhack / resizebox

Function resizebox

depends/lua/src/lauxlib.c:461–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459
460
461static void *resizebox (lua_State *L, int idx, size_t newsize) {
462 void *ud;
463 lua_Alloc allocf = lua_getallocf(L, &ud);
464 UBox *box = (UBox *)lua_touserdata(L, idx);
465 void *temp = allocf(ud, box->box, box->bsize, newsize);
466 if (temp == NULL && newsize > 0) { /* allocation error? */
467 resizebox(L, idx, 0); /* free buffer */
468 luaL_error(L, "not enough memory for buffer allocation");
469 }
470 box->box = temp;
471 box->bsize = newsize;
472 return temp;
473}
474
475
476static int boxgc (lua_State *L) {

Callers 4

boxgcFunction · 0.85
newboxFunction · 0.85
luaL_prepbuffsizeFunction · 0.85
luaL_pushresultFunction · 0.85

Calls 3

lua_getallocfFunction · 0.85
lua_touserdataFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected