From 1dd8c9b6b6db5500b68a11e097c67e7a39c4f53d Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 31 Aug 2004 14:57:33 -0300
Subject: detail

---
 ltable.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/ltable.c b/ltable.c
index 67194a8e..8c00deec 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
 /*
-** $Id: ltable.c,v 2.3 2004/04/30 20:13:38 roberto Exp roberto $
+** $Id: ltable.c,v 2.4 2004/08/10 19:17:23 roberto Exp roberto $
 ** Lua tables (hash)
 ** See Copyright Notice in lua.h
 */
@@ -393,21 +393,6 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
 }
 
 
-/*
-** generic search function
-*/
-static const TValue *luaH_getany (Table *t, const TValue *key) {
-  if (!ttisnil(key)) {
-    Node *n = luaH_mainposition(t, key);
-    do {  /* check whether `key' is somewhere in the chain */
-      if (luaO_rawequalObj(gkey(n), key)) return gval(n);  /* that's it */
-      else n = n->next;
-    } while (n);
-  }
-  return &luaO_nilobject;
-}
-
-
 /*
 ** search function for integers
 */
@@ -446,6 +431,7 @@ const TValue *luaH_getstr (Table *t, TString *key) {
 */
 const TValue *luaH_get (Table *t, const TValue *key) {
   switch (ttype(key)) {
+    case LUA_TNIL: return &luaO_nilobject;
     case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
     case LUA_TNUMBER: {
       int k;
@@ -454,7 +440,14 @@ const TValue *luaH_get (Table *t, const TValue *key) {
         return luaH_getnum(t, k);  /* use specialized version */
       /* else go through */
     }
-    default: return luaH_getany(t, key);
+    default: {
+      Node *n = luaH_mainposition(t, key);
+      do {  /* check whether `key' is somewhere in the chain */
+        if (luaO_rawequalObj(gkey(n), key)) return gval(n);  /* that's it */
+        else n = n->next;
+      } while (n);
+      return &luaO_nilobject;
+    }
   }
 }
 
-- 
cgit v1.2.3-55-g6feb