mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
hashtable: fix linked list
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
#include <logging.h>
|
||||||
|
|
||||||
static scache_t *hashentrycache;
|
static scache_t *hashentrycache;
|
||||||
|
|
||||||
@@ -44,11 +45,15 @@ int hashtable_set(hashtable_t *table, void *value, void *key, size_t keysize, bo
|
|||||||
memcpy(entry->key, key, keysize);
|
memcpy(entry->key, key, keysize);
|
||||||
entry->prev = NULL;
|
entry->prev = NULL;
|
||||||
entry->next = table->entries[tableoffset];
|
entry->next = table->entries[tableoffset];
|
||||||
|
if (entry->next)
|
||||||
|
entry->next->prev = entry;
|
||||||
|
|
||||||
entry->value = value;
|
entry->value = value;
|
||||||
entry->keysize = keysize;
|
entry->keysize = keysize;
|
||||||
entry->hash = hash;
|
entry->hash = hash;
|
||||||
table->entries[tableoffset] = entry;
|
table->entries[tableoffset] = entry;
|
||||||
++table->entrycount;
|
++table->entrycount;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user