From c63e5d212bc5dec1b1c749e3f07b42cd83081826 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 5 Feb 2021 17:51:25 -0300 Subject: New macro 'completestate' --- lmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lmem.c') diff --git a/lmem.c b/lmem.c index 43739bff..4822a0ea 100644 --- a/lmem.c +++ b/lmem.c @@ -29,7 +29,7 @@ ** a full GC cycle at every allocation.) */ static void *firsttry (global_State *g, void *block, size_t os, size_t ns) { - if (ttisnil(&g->nilvalue) && ns > os) + if (completestate(g) && ns > os) return NULL; /* fail */ else /* normal allocation */ return (*g->frealloc)(g->ud, block, os, ns); @@ -146,7 +146,7 @@ void luaM_free_ (lua_State *L, void *block, size_t osize) { static void *tryagain (lua_State *L, void *block, size_t osize, size_t nsize) { global_State *g = G(L); - if (ttisnil(&g->nilvalue)) { /* is state fully build? */ + if (completestate(g)) { /* is state fully build? */ luaC_fullgc(L, 1); /* try to free some memory... */ return (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ } -- cgit v1.2.3-55-g6feb