aboutsummaryrefslogtreecommitdiff
path: root/ldo.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-08 15:28:25 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-08 15:28:25 -0200
commite663a24ab03a54fa221c20a793812e5c5ffdf94f (patch)
tree8fbd40f779f0eed29d46f26c07e1234fd5df8bae /ldo.h
parent40f823ec907fd725617e37199199b3ed424bd88c (diff)
downloadlua-e663a24ab03a54fa221c20a793812e5c5ffdf94f.tar.gz
lua-e663a24ab03a54fa221c20a793812e5c5ffdf94f.tar.bz2
lua-e663a24ab03a54fa221c20a793812e5c5ffdf94f.zip
more freedom in handling memory-allocation errors (not all allocations
automatically raise an error), which allows fixing a bug when resizing a table.
Diffstat (limited to 'ldo.h')
-rw-r--r--ldo.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/ldo.h b/ldo.h
index a9b46cdf..388f6c3e 100644
--- a/ldo.h
+++ b/ldo.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.h,v 2.35 2017/11/23 16:35:54 roberto Exp roberto $ 2** $Id: ldo.h,v 2.36 2017/11/23 18:29:41 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -22,7 +22,8 @@
22*/ 22*/
23#define luaD_checkstackaux(L,n,pre,pos) \ 23#define luaD_checkstackaux(L,n,pre,pos) \
24 if (L->stack_last - L->top <= (n)) \ 24 if (L->stack_last - L->top <= (n)) \
25 { pre; luaD_growstack(L, n); pos; } else { condmovestack(L,pre,pos); } 25 { pre; luaD_growstack(L, n, 1); pos; } \
26 else { condmovestack(L,pre,pos); }
26 27
27/* In general, 'pre'/'pos' are empty (nothing to save) */ 28/* In general, 'pre'/'pos' are empty (nothing to save) */
28#define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) 29#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,
55 ptrdiff_t oldtop, ptrdiff_t ef); 56 ptrdiff_t oldtop, ptrdiff_t ef);
56LUAI_FUNC void luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, 57LUAI_FUNC void luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult,
57 int nres); 58 int nres);
58LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); 59LUAI_FUNC int luaD_reallocstack (lua_State *L, int newsize, int safe);
59LUAI_FUNC void luaD_growstack (lua_State *L, int n); 60LUAI_FUNC int luaD_growstack (lua_State *L, int n, int safe);
60LUAI_FUNC void luaD_shrinkstack (lua_State *L); 61LUAI_FUNC void luaD_shrinkstack (lua_State *L);
61LUAI_FUNC void luaD_inctop (lua_State *L); 62LUAI_FUNC void luaD_inctop (lua_State *L);
62 63