aboutsummaryrefslogtreecommitdiff
path: root/src/common/libalgo/hashtbl.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2015-03-11 16:22:40 +0100
committerAlex Auvolat <alex@adnab.me>2015-03-11 16:22:40 +0100
commit9b9ef5a2c0ec8e66c7da24c4229d89a90a10e914 (patch)
tree471cb88f003eb58ce84342f2e7ab7effda04ce2d /src/common/libalgo/hashtbl.c
parenta7ff74cdf2835625282491242ede57b05ceaa782 (diff)
downloadkogata-9b9ef5a2c0ec8e66c7da24c4229d89a90a10e914.tar.gz
kogata-9b9ef5a2c0ec8e66c7da24c4229d89a90a10e914.zip
Bugfixing in progress. Strange bug: wait_on adds to waiters but later not in waiters.
Diffstat (limited to 'src/common/libalgo/hashtbl.c')
-rw-r--r--src/common/libalgo/hashtbl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/libalgo/hashtbl.c b/src/common/libalgo/hashtbl.c
index f34c6d4..7192bd4 100644
--- a/src/common/libalgo/hashtbl.c
+++ b/src/common/libalgo/hashtbl.c
@@ -90,11 +90,11 @@ static void hashtbl_check_size(hashtbl_t *ht) {
}
bool hashtbl_add(hashtbl_t *ht, void* key, void* v) {
- size_t slot = SLOT_OF_HASH(ht->hf(key), ht->size);
-
hashtbl_item_t *i = (hashtbl_item_t*)malloc(sizeof(hashtbl_item_t));
if (i == 0) return false; // OOM
+ size_t slot = SLOT_OF_HASH(ht->hf(key), ht->size);
+
// make sure item is not already present
hashtbl_remove(ht, key);