new macro 'NILCONSTANT' to initialize nil constants

This commit is contained in:
Roberto Ierusalimschy 2009-11-06 15:07:12 -02:00
parent a921d81033
commit 49a67c6d3f
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lobject.c,v 2.30 2009/05/27 17:11:27 roberto Exp roberto $ ** $Id: lobject.c,v 2.31 2009/06/17 17:48:34 roberto Exp roberto $
** Some generic functions over Lua objects ** Some generic functions over Lua objects
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -25,7 +25,7 @@
const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; const TValue luaO_nilobject_ = {NILCONSTANT};
/* /*

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltable.c,v 2.42 2009/10/23 12:31:12 roberto Exp roberto $ ** $Id: ltable.c,v 2.43 2009/11/05 17:43:54 roberto Exp roberto $
** Lua tables (hash) ** Lua tables (hash)
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -72,8 +72,8 @@
#define dummynode (&dummynode_) #define dummynode (&dummynode_)
static const Node dummynode_ = { static const Node dummynode_ = {
{{NULL}, LUA_TNIL}, /* value */ {NILCONSTANT}, /* value */
{{{NULL}, LUA_TNIL, NULL}} /* key */ {{NILCONSTANT, NULL}} /* key */
}; };
@ -418,7 +418,7 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
mp = n; mp = n;
} }
} }
setnodekey(mp, key); setobj2t(L, gkey(mp), key);
luaC_barriert(L, t, key); luaC_barriert(L, t, key);
lua_assert(ttisnil(gval(mp))); lua_assert(ttisnil(gval(mp)));
return gval(mp); return gval(mp);