From 505fc9122255b8a2ef761720bca21fd5e9be8e73 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 1 Jun 2018 14:40:38 -0300 Subject: no more 'luaO_nilobject' to avoid comparison of global variable addresses (now uses static variables) --- ltm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ltm.c') diff --git a/ltm.c b/ltm.c index 6d285510..f0784305 100644 --- a/ltm.c +++ b/ltm.c @@ -1,5 +1,5 @@ /* -** $Id: ltm.c,v 2.66 2018/02/27 17:48:28 roberto Exp roberto $ +** $Id: ltm.c,v 2.67 2018/04/04 14:23:41 roberto Exp roberto $ ** Tag methods ** See Copyright Notice in lua.h */ @@ -69,6 +69,7 @@ const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { + static const TValue nilobject = {NILCONSTANT}; Table *mt; switch (ttype(o)) { case LUA_TTABLE: @@ -80,7 +81,7 @@ const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { default: mt = G(L)->mt[ttype(o)]; } - return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : luaO_nilobject); + return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : &nilobject); } -- cgit v1.2.3-55-g6feb