no more 'luaO_nilobject' to avoid comparison of global variable addresses
(now uses static variables)
This commit is contained in:
5
ltm.c
5
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user