MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaM_growaux_

Function luaM_growaux_

freebsd/contrib/openzfs/module/lua/lmem.c:45–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44
45void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,
46 int limit, const char *what) {
47 void *newblock;
48 int newsize;
49 if (*size >= limit/2) { /* cannot double it? */
50 if (*size >= limit) /* cannot grow even a little? */
51 luaG_runerror(L, "too many %s (limit is %d)", what, limit);
52 newsize = limit; /* still have at least one free place */
53 }
54 else {
55 newsize = (*size)*2;
56 if (newsize < MINSIZEARRAY)
57 newsize = MINSIZEARRAY; /* minimum size */
58 }
59 newblock = luaM_reallocv(L, block, *size, newsize, size_elems);
60 *size = newsize; /* update only when everything else is OK */
61 return newblock;
62}
63
64
65l_noret luaM_toobig (lua_State *L) {

Callers

nothing calls this directly

Calls 1

luaG_runerrorFunction · 0.70

Tested by

no test coverage detected