From 62ec3797d518f55513c992fe1819dc5dbb072226 Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 7 Nov 1994 13:19:51 -0200
Subject: inheritance is not built-in

---
 hash.c | 40 +++++-----------------------------------
 1 file changed, 5 insertions(+), 35 deletions(-)

(limited to 'hash.c')

diff --git a/hash.c b/hash.c
index bed99340..e0df91cc 100644
--- a/hash.c
+++ b/hash.c
@@ -3,7 +3,7 @@
 ** hash manager for lua
 */
 
-char *rcs_hash="$Id: hash.c,v 2.11 1994/11/02 20:29:09 roberto Exp roberto $";
+char *rcs_hash="$Id: hash.c,v 2.12 1994/11/03 22:20:15 roberto Exp $";
 
 #include <string.h>
 #include <stdlib.h>
@@ -235,47 +235,17 @@ static void rehash (Hash *t)
 }
 
 /*
-** If the hash node is present, return its pointer, otherwise search
-** the node at parent table, recursively, if there is parent.
-** If no parent and the node is not present, return a static nil object.
+** If the hash node is present, return its pointer, otherwise return
+** null.
 */
 Object *lua_hashget (Hash *t, Object *ref)
 {
- static int count = 1000;
- static Object nil_obj = {LUA_T_NIL, {NULL}};
  int h = present(t, ref);
  if (tag(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h));
- if (--count == 0) 
-   lua_reportbug ("hierarchy too deep (maybe there is an inheritance loop)");
- { /* check "parent" or "godparent" field */
-  Hash *p;
-  Object parent;
-  Object godparent;
-  tag(&parent) = LUA_T_STRING; svalue(&parent) = "parent";
-  tag(&godparent) = LUA_T_STRING; svalue(&godparent) = "godparent";
-
-  h = present(t, &parent);
-  p = tag(ref(node(t, h))) != LUA_T_NIL && tag(val(node(t, h))) == LUA_T_ARRAY ?
-      avalue(val(node(t, h))) : NULL;
-  if (p != NULL)
-  {
-   Object *r = lua_hashget(p, ref);
-   if (tag(r) != LUA_T_NIL) { count++; return r; }
-  }
-
-  h = present(t, &godparent);
-  p = tag(ref(node(t, h))) != LUA_T_NIL && tag(val(node(t, h))) == LUA_T_ARRAY ?
-      avalue(val(node(t, h))) : NULL;
-  if (p != NULL)
-  {
-   Object *r = lua_hashget(p, ref);
-   if (tag(r) != LUA_T_NIL) { count++; return r; }
-  }
- }
- count++;
- return &nil_obj;
+ else return NULL;
 }
 
+
 /*
 ** If the hash node is present, return its pointer, otherwise create a new
 ** node for the given reference and also return its pointer.
-- 
cgit v1.2.3-55-g6feb