| 474 | |
| 475 | |
| 476 | static 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 | |
| 491 | static int boxgc (lua_State *L) { |
no test coverage detected