diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-29 13:22:24 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-29 13:22:24 -0300 |
commit | 07c7fdb9df82c7fc4ae501e21262f781df4ae5e5 (patch) | |
tree | d270600a7d359461f68b1d1e80e7ec4182d405ca /ltable.c | |
parent | 3ccbae84d2be8e2978a65bcea15b3fffba7664f5 (diff) | |
download | lua-github-07c7fdb9df82c7fc4ae501e21262f781df4ae5e5.tar.gz |
simpler definition for 'setobj' (trust the compiler for the assignment)
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 2.91 2014/06/26 16:17:35 roberto Exp roberto $ +** $Id: ltable.c,v 2.92 2014/07/18 13:36:14 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -309,7 +309,7 @@ static void setnodevector (lua_State *L, Table *t, int size) { for (i=0; i<size; i++) { Node *n = gnode(t, i); gnext(n) = 0; - setnilvalue(gkey(n)); + setnilvalue(wgkey(n)); setnilvalue(gval(n)); } } @@ -466,7 +466,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { mp = f; } } - setobj2t(L, gkey(mp), key); + setkey(L, &mp->i_key, key); luaC_barrierback(L, t, key); lua_assert(ttisnil(gval(mp))); return gval(mp); @@ -503,7 +503,8 @@ const TValue *luaH_getstr (Table *t, TString *key) { Node *n = hashstr(t, key); lua_assert(key->tt == LUA_TSHRSTR); for (;;) { /* check whether `key' is somewhere in the chain */ - if (ttisshrstring(gkey(n)) && eqshrstr(tsvalue(gkey(n)), key)) + const TValue *k = gkey(n); + if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) return gval(n); /* that's it */ else { int nx = gnext(n); |