From b405fb0ad740cc4ec21923989be220c64301569f Mon Sep 17 00:00:00 2001 From: Waldemar Celes Date: Fri, 17 Dec 1993 16:41:19 -0200 Subject: hash manager for lua --- hash.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/hash.c b/hash.c index 8743d52c..fa1f3b8b 100644 --- a/hash.c +++ b/hash.c @@ -2,10 +2,10 @@ ** hash.c ** hash manager for lua ** Luiz Henrique de Figueiredo - 17 Aug 90 -** Modified by Waldemar Celes Filho -** 12 May 93 */ +char *rcs_hash="$Id: $"; + #include #include @@ -184,11 +184,25 @@ static void firstnode (Hash *a, int h) int i; for (i=h; ival) != T_NIL) + if (list(a,i) != NULL) { - lua_pushobject (&list(a,i)->ref); - lua_pushobject (&list(a,i)->val); - return; + if (tag(&list(a,i)->val) != T_NIL) + { + lua_pushobject (&list(a,i)->ref); + lua_pushobject (&list(a,i)->val); + return; + } + else + { + Node *next = list(a,i)->next; + while (next != NULL && tag(&next->val) == T_NIL) next = next->next; + if (next != NULL) + { + lua_pushobject (&next->ref); + lua_pushobject (&next->val); + return; + } + } } } } @@ -257,3 +271,4 @@ void lua_next (void) } } } + -- cgit v1.2.3-55-g6feb