From ce6f5502c99ce9a367e25b678e375db6f8164d73 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 18 Mar 2024 15:56:32 -0300 Subject: 'luaH_get' functions return 'TValue' Instead of receiving a parameter telling them where to put the result of the query, these functions return the TValue directly. (That is, they return a structure.) --- lvm.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lvm.h') diff --git a/lvm.h b/lvm.h index 54ee5dd7..3b11e789 100644 --- a/lvm.h +++ b/lvm.h @@ -78,17 +78,19 @@ typedef enum { /* ** fast track for 'gettable' */ -#define luaV_fastget(t,k,res,f, hres) \ - (hres = (!ttistable(t) ? HNOTATABLE : f(hvalue(t), k, res))) +#define luaV_fastget(t,k,res,f, aux) \ + {if (!ttistable(t)) setnotableV(aux); \ + else { aux = f(hvalue(t), k); \ + if (!isemptyV(aux)) { setobjV(cast(lua_State*, NULL), res, aux); } } } /* ** Special case of 'luaV_fastget' for integers, inlining the fast case ** of 'luaH_getint'. */ -#define luaV_fastgeti(t,k,res,hres) \ - if (!ttistable(t)) hres = HNOTATABLE; \ - else { luaH_fastgeti(hvalue(t), k, res, hres); } +#define luaV_fastgeti(t,k,res,aux) \ + { if (!ttistable(t)) setnotableV(aux); \ + else { luaH_fastgeti(hvalue(t), k, res, aux); } } #define luaV_fastset(t,k,val,hres,f) \ @@ -120,8 +122,10 @@ LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, F2Imod mode); LUAI_FUNC int luaV_tointegerns (const TValue *obj, lua_Integer *p, F2Imod mode); LUAI_FUNC int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode); -LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, - StkId val, int aux); +#define luaV_finishget(L,t,key,val,aux) \ + luaV_finishget_(L,t,key,val,ttypetagV(aux)) +LUAI_FUNC void luaV_finishget_ (lua_State *L, const TValue *t, TValue *key, + StkId val, int tag); LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, TValue *val, int aux); LUAI_FUNC void luaV_finishOp (lua_State *L); -- cgit v1.2.3-55-g6feb