From 9e2568a40b37fde6242415460ceff04568eaaa93 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Oct 2013 16:44:22 +0800 Subject: [PATCH] hash list bug --- service-src/hashid.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service-src/hashid.h b/service-src/hashid.h index d7421547..dc410eb2 100644 --- a/service-src/hashid.h +++ b/service-src/hashid.h @@ -70,7 +70,7 @@ hashid_remove(struct hashid *hi, int id) { } while(c->next) { if (c->next->id == id) { - struct hashid_node * temp = c; + struct hashid_node * temp = c->next; c->next = temp->next; c = temp; goto _clear; @@ -103,9 +103,9 @@ hashid_insert(struct hashid * hi, int id) { int h = id & hi->hashmod; if (hi->hash[h]) { c->next = hi->hash[h]; - } else { - hi->hash[h] = c; } + hi->hash[h] = c; + return c - hi->id; }