MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / resizebox

Function resizebox

lib/lua/src/lauxlib.c:476–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474
475
476static void *resizebox (lua_State *L, int idx, size_t newsize) {
477 void *ud;
478 lua_Alloc allocf = lua_getallocf(L, &ud);
479 UBox *box = (UBox *)lua_touserdata(L, idx);
480 void *temp = allocf(ud, box->box, box->bsize, newsize);
481 if (l_unlikely(temp == NULL && newsize > 0)) { /* allocation error? */
482 lua_pushliteral(L, "not enough memory");
483 lua_error(L); /* raise a memory error */
484 }
485 box->box = temp;
486 box->bsize = newsize;
487 return temp;
488}
489
490
491static int boxgc (lua_State *L) {

Callers 2

boxgcFunction · 0.85
prepbuffsizeFunction · 0.85

Calls 3

lua_getallocfFunction · 0.85
lua_touserdataFunction · 0.85
lua_errorFunction · 0.85

Tested by

no test coverage detected