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

Function luaM_growaux_

depends/lua/src/lmem.c:48–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

luaG_runerrorFunction · 0.85

Tested by

no test coverage detected