MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaM_growaux_

Function luaM_growaux_

third-party/lua-5.2.4/src/lmem.c:46–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

luaG_runerrorFunction · 0.70

Tested by

no test coverage detected