'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.)
This commit is contained in:
Roberto Ierusalimschy
2024-03-18 15:56:32 -03:00
parent ba71060381
commit ce6f5502c9
9 changed files with 124 additions and 122 deletions

18
lvm.h
View File

@@ -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);