MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / l_alloc

Function l_alloc

source/extern/lua/lauxlib.c:1008–1021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1006
1007
1008static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
1009 (void)ud; (void)osize; /* not used */
1010 if (nsize == 0) {
1011 free(ptr);
1012 return NULL;
1013 }
1014 else { /* cannot fail when shrinking a block */
1015 void *newptr = realloc(ptr, nsize);
1016 if (newptr == NULL && ptr != NULL && nsize <= osize)
1017 return ptr; /* keep the original block */
1018 else /* no fail or not shrinking */
1019 return newptr; /* use the new block */
1020 }
1021}
1022
1023
1024static int panic (lua_State *L) {

Callers

nothing calls this directly

Calls 2

freeFunction · 0.50
reallocFunction · 0.50

Tested by

no test coverage detected