diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-01 14:40:38 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-01 14:40:38 -0300 |
| commit | 505fc9122255b8a2ef761720bca21fd5e9be8e73 (patch) | |
| tree | cf3fe8068546547e7f53e86e16a32ee923a4c514 /ltm.c | |
| parent | fb8fa661366e15e98c60d8929feaab9e551a02f9 (diff) | |
| download | lua-505fc9122255b8a2ef761720bca21fd5e9be8e73.tar.gz lua-505fc9122255b8a2ef761720bca21fd5e9be8e73.tar.bz2 lua-505fc9122255b8a2ef761720bca21fd5e9be8e73.zip | |
no more 'luaO_nilobject' to avoid comparison of global variable addresses
(now uses static variables)
Diffstat (limited to 'ltm.c')
| -rw-r--r-- | ltm.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltm.c,v 2.66 2018/02/27 17:48:28 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.67 2018/04/04 14:23:41 roberto Exp roberto $ |
| 3 | ** Tag methods | 3 | ** Tag methods |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -69,6 +69,7 @@ const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { | |||
| 69 | 69 | ||
| 70 | 70 | ||
| 71 | const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { | 71 | const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { |
| 72 | static const TValue nilobject = {NILCONSTANT}; | ||
| 72 | Table *mt; | 73 | Table *mt; |
| 73 | switch (ttype(o)) { | 74 | switch (ttype(o)) { |
| 74 | case LUA_TTABLE: | 75 | case LUA_TTABLE: |
| @@ -80,7 +81,7 @@ const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { | |||
| 80 | default: | 81 | default: |
| 81 | mt = G(L)->mt[ttype(o)]; | 82 | mt = G(L)->mt[ttype(o)]; |
| 82 | } | 83 | } |
| 83 | return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : luaO_nilobject); | 84 | return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : &nilobject); |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | 87 | ||
