no more 'luaO_nilobject' to avoid comparison of global variable addresses

(now uses static variables)
This commit is contained in:
Roberto Ierusalimschy
2018-06-01 14:40:38 -03:00
parent fb8fa66136
commit 505fc91222
5 changed files with 12 additions and 20 deletions

5
ltm.c
View File

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