aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-05-31 15:24:36 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-05-31 15:24:36 -0300
commit9b7dddad7d3f4546f838834d9674eaf0f2fca3dd (patch)
treecf0f283b5177d481023d0724d1c08a95d7482005 /ltable.c
parent3f04a9f2c07bc06dddbc473178b314f1fd686701 (diff)
downloadlua-9b7dddad7d3f4546f838834d9674eaf0f2fca3dd.tar.gz
lua-9b7dddad7d3f4546f838834d9674eaf0f2fca3dd.tar.bz2
lua-9b7dddad7d3f4546f838834d9674eaf0f2fca3dd.zip
no need for two different implementations for equality (one raw and
one with metamethods)
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ltable.c b/ltable.c
index e8789a55..60f579a6 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.54 2011/04/05 18:32:28 roberto Exp roberto $ 2** $Id: ltable.c,v 2.55 2011/05/02 16:45:32 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*/
@@ -33,6 +33,7 @@
33#include "lstate.h" 33#include "lstate.h"
34#include "lstring.h" 34#include "lstring.h"
35#include "ltable.h" 35#include "ltable.h"
36#include "lvm.h"
36 37
37 38
38/* 39/*
@@ -148,7 +149,7 @@ static int findindex (lua_State *L, Table *t, StkId key) {
148 Node *n = mainposition(t, key); 149 Node *n = mainposition(t, key);
149 do { /* check whether `key' is somewhere in the chain */ 150 do { /* check whether `key' is somewhere in the chain */
150 /* key may be dead already, but it is ok to use it in `next' */ 151 /* key may be dead already, but it is ok to use it in `next' */
151 if (luaO_rawequalObj(gkey(n), key) || 152 if (luaV_rawequalObj(gkey(n), key) ||
152 (ttisdeadkey(gkey(n)) && iscollectable(key) && 153 (ttisdeadkey(gkey(n)) && iscollectable(key) &&
153 gcvalue(gkey(n)) == gcvalue(key))) { 154 gcvalue(gkey(n)) == gcvalue(key))) {
154 i = cast_int(n - gnode(t, 0)); /* key index in hash table */ 155 i = cast_int(n - gnode(t, 0)); /* key index in hash table */
@@ -481,7 +482,7 @@ const TValue *luaH_get (Table *t, const TValue *key) {
481 default: { 482 default: {
482 Node *n = mainposition(t, key); 483 Node *n = mainposition(t, key);
483 do { /* check whether `key' is somewhere in the chain */ 484 do { /* check whether `key' is somewhere in the chain */
484 if (luaO_rawequalObj(gkey(n), key)) 485 if (luaV_rawequalObj(gkey(n), key))
485 return gval(n); /* that's it */ 486 return gval(n); /* that's it */
486 else n = gnext(n); 487 else n = gnext(n);
487 } while (n); 488 } while (n);