25 #if defined(EMERGENCYGCTESTS) 38 #define firsttry(g,block,os,ns) ((*g->frealloc)(g->ud, block, os, ns)) 76 #define MINSIZEARRAY 4 80 int size_elems,
int limit,
const char *what) {
83 if (nelems + 1 <= size)
85 if (size >= limit / 2) {
95 lua_assert(nelems + 1 <= size && size <= limit);
111 int final_n,
int size_elem) {
113 size_t oldsize =
cast_sizet((*size) * size_elem);
114 size_t newsize =
cast_sizet(final_n * size_elem);
147 size_t osize,
size_t nsize) {
166 newblock =
firsttry(g, block, osize, nsize);
167 if (
unlikely(newblock == NULL && nsize > 0)) {
169 newblock =
tryagain(L, block, osize, nsize);
170 if (newblock == NULL)
173 lua_assert((nsize == 0) == (newblock == NULL));
182 if (
unlikely(newblock == NULL && nsize > 0))
193 void *newblock =
firsttry(g, NULL, tag, size);
195 newblock =
tryagain(L, NULL, tag, size);
196 if (newblock == NULL)
l_noret luaM_toobig(lua_State *L)
void * luaM_saferealloc_(lua_State *L, void *block, size_t osize, size_t nsize)
static void * tryagain(lua_State *L, void *block, size_t osize, size_t nsize)
void * luaM_shrinkvector_(lua_State *L, void *block, int *size, int final_n, int size_elem)
void * luaM_realloc_(lua_State *L, void *block, size_t osize, size_t nsize)
static void block(LexState *ls)
l_noret luaG_runerror(lua_State *L, const char *fmt,...)
void * luaM_growaux_(lua_State *L, void *block, int nelems, int *psize, int size_elems, int limit, const char *what)
void luaM_free_(lua_State *L, void *block, size_t osize)
void * luaM_malloc_(lua_State *L, size_t size, int tag)
#define firsttry(g, block, os, ns)
void luaC_fullgc(lua_State *L, int isemergency)