From 3b7a36653b5da227502ec5a3c677b6a351af67be Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Mon, 14 Nov 1994 16:41:15 -0200 Subject: lua_equalObj now is global (and is used by opcode) --- hash.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'hash.c') diff --git a/hash.c b/hash.c index 09ef8bcb..c3dfa160 100644 --- a/hash.c +++ b/hash.c @@ -3,7 +3,7 @@ ** hash manager for lua */ -char *rcs_hash="$Id: hash.c,v 2.14 1994/11/07 16:34:44 roberto Exp $"; +char *rcs_hash="$Id: hash.c,v 2.15 1994/11/10 17:36:54 roberto Exp $"; #include <string.h> #include <stdlib.h> @@ -82,13 +82,17 @@ static int hashindex (Hash *t, Object *ref) /* hash function */ } } -static int equalObj (Object *t1, Object *t2) +int lua_equalObj (Object *t1, Object *t2) { if (tag(t1) != tag(t2)) return 0; switch (tag(t1)) { + case LUA_T_NIL: return 1; case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2); case LUA_T_STRING: return streq(svalue(t1), svalue(t2)); + case LUA_T_ARRAY: return avalue(t1) == avalue(t2); + case LUA_T_FUNCTION: return bvalue(t1) == bvalue(t2); + case LUA_T_CFUNCTION: return fvalue(t1) == fvalue(t2); default: return uvalue(t1) == uvalue(t2); } } @@ -98,7 +102,7 @@ static int present (Hash *t, Object *ref) int h = hashindex(t, ref); while (tag(ref(node(t, h))) != LUA_T_NIL) { - if (equalObj(ref, ref(node(t, h)))) + if (lua_equalObj(ref, ref(node(t, h)))) return h; h = (h+1) % nhash(t); } -- cgit v1.2.3-55-g6feb