diff options
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.50 2010/04/18 13:22:48 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.51 2010/06/04 13:05:29 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -148,7 +148,7 @@ static int findindex (lua_State *L, Table *t, StkId key) { | |||
148 | Node *n = mainposition(t, key); | 148 | Node *n = mainposition(t, key); |
149 | do { /* check whether `key' is somewhere in the chain */ | 149 | do { /* check whether `key' is somewhere in the chain */ |
150 | /* key may be dead already, but it is ok to use it in `next' */ | 150 | /* key may be dead already, but it is ok to use it in `next' */ |
151 | if (luaO_rawequalObj(key2tval(n), key) || | 151 | if (luaO_rawequalObj(gkey(n), key) || |
152 | (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && | 152 | (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && |
153 | gcvalue(gkey(n)) == gcvalue(key))) { | 153 | gcvalue(gkey(n)) == gcvalue(key))) { |
154 | i = cast_int(n - gnode(t, 0)); /* key index in hash table */ | 154 | i = cast_int(n - gnode(t, 0)); /* key index in hash table */ |
@@ -174,7 +174,7 @@ int luaH_next (lua_State *L, Table *t, StkId key) { | |||
174 | } | 174 | } |
175 | for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ | 175 | for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ |
176 | if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ | 176 | if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ |
177 | setobj2s(L, key, key2tval(gnode(t, i))); | 177 | setobj2s(L, key, gkey(gnode(t, i))); |
178 | setobj2s(L, key+1, gval(gnode(t, i))); | 178 | setobj2s(L, key+1, gval(gnode(t, i))); |
179 | return 1; | 179 | return 1; |
180 | } | 180 | } |
@@ -255,7 +255,7 @@ static int numusehash (const Table *t, int *nums, int *pnasize) { | |||
255 | while (i--) { | 255 | while (i--) { |
256 | Node *n = &t->node[i]; | 256 | Node *n = &t->node[i]; |
257 | if (!ttisnil(gval(n))) { | 257 | if (!ttisnil(gval(n))) { |
258 | ause += countint(key2tval(n), nums); | 258 | ause += countint(gkey(n), nums); |
259 | totaluse++; | 259 | totaluse++; |
260 | } | 260 | } |
261 | } | 261 | } |
@@ -321,7 +321,7 @@ void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) { | |||
321 | for (i = twoto(oldhsize) - 1; i >= 0; i--) { | 321 | for (i = twoto(oldhsize) - 1; i >= 0; i--) { |
322 | Node *old = nold+i; | 322 | Node *old = nold+i; |
323 | if (!ttisnil(gval(old))) | 323 | if (!ttisnil(gval(old))) |
324 | setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old)); | 324 | setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old)); |
325 | } | 325 | } |
326 | if (!isdummy(nold)) | 326 | if (!isdummy(nold)) |
327 | luaM_freearray(L, nold, twoto(oldhsize)); /* free old array */ | 327 | luaM_freearray(L, nold, twoto(oldhsize)); /* free old array */ |
@@ -406,7 +406,7 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) { | |||
406 | return luaH_set(L, t, key); /* re-insert key into grown table */ | 406 | return luaH_set(L, t, key); /* re-insert key into grown table */ |
407 | } | 407 | } |
408 | lua_assert(!isdummy(n)); | 408 | lua_assert(!isdummy(n)); |
409 | othern = mainposition(t, key2tval(mp)); | 409 | othern = mainposition(t, gkey(mp)); |
410 | if (othern != mp) { /* is colliding node out of its main position? */ | 410 | if (othern != mp) { /* is colliding node out of its main position? */ |
411 | /* yes; move colliding node into free position */ | 411 | /* yes; move colliding node into free position */ |
412 | while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ | 412 | while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ |
@@ -481,7 +481,7 @@ const TValue *luaH_get (Table *t, const TValue *key) { | |||
481 | default: { | 481 | default: { |
482 | Node *n = mainposition(t, key); | 482 | Node *n = mainposition(t, key); |
483 | do { /* check whether `key' is somewhere in the chain */ | 483 | do { /* check whether `key' is somewhere in the chain */ |
484 | if (luaO_rawequalObj(key2tval(n), key)) | 484 | if (luaO_rawequalObj(gkey(n), key)) |
485 | return gval(n); /* that's it */ | 485 | return gval(n); /* that's it */ |
486 | else n = gnext(n); | 486 | else n = gnext(n); |
487 | } while (n); | 487 | } while (n); |