From e663a24ab03a54fa221c20a793812e5c5ffdf94f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 8 Dec 2017 15:28:25 -0200 Subject: more freedom in handling memory-allocation errors (not all allocations automatically raise an error), which allows fixing a bug when resizing a table. --- ldo.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ldo.h') diff --git a/ldo.h b/ldo.h index a9b46cdf..388f6c3e 100644 --- a/ldo.h +++ b/ldo.h @@ -1,5 +1,5 @@ /* -** $Id: ldo.h,v 2.35 2017/11/23 16:35:54 roberto Exp roberto $ +** $Id: ldo.h,v 2.36 2017/11/23 18:29:41 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -22,7 +22,8 @@ */ #define luaD_checkstackaux(L,n,pre,pos) \ if (L->stack_last - L->top <= (n)) \ - { pre; luaD_growstack(L, n); pos; } else { condmovestack(L,pre,pos); } + { pre; luaD_growstack(L, n, 1); pos; } \ + else { condmovestack(L,pre,pos); } /* In general, 'pre'/'pos' are empty (nothing to save) */ #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) @@ -55,8 +56,8 @@ LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t oldtop, ptrdiff_t ef); LUAI_FUNC void luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres); -LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); -LUAI_FUNC void luaD_growstack (lua_State *L, int n); +LUAI_FUNC int luaD_reallocstack (lua_State *L, int newsize, int safe); +LUAI_FUNC int luaD_growstack (lua_State *L, int n, int safe); LUAI_FUNC void luaD_shrinkstack (lua_State *L); LUAI_FUNC void luaD_inctop (lua_State *L); -- cgit v1.2.3-55-g6feb