Merge pull request #48 from codenot/master

hash list bug
This commit is contained in:
云风
2013-10-16 22:45:51 -07:00

View File

@@ -70,7 +70,7 @@ hashid_remove(struct hashid *hi, int id) {
} }
while(c->next) { while(c->next) {
if (c->next->id == id) { if (c->next->id == id) {
struct hashid_node * temp = c; struct hashid_node * temp = c->next;
c->next = temp->next; c->next = temp->next;
c = temp; c = temp;
goto _clear; goto _clear;
@@ -103,9 +103,9 @@ hashid_insert(struct hashid * hi, int id) {
int h = id & hi->hashmod; int h = id & hi->hashmod;
if (hi->hash[h]) { if (hi->hash[h]) {
c->next = hi->hash[h]; c->next = hi->hash[h];
} else {
hi->hash[h] = c;
} }
hi->hash[h] = c;
return c - hi->id; return c - hi->id;
} }