diff options
author | Alex Auvolat <alex@adnab.me> | 2015-03-11 16:50:13 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2015-03-11 16:50:13 +0100 |
commit | 64b9108a58d3483e9b63511c4cf74b12dceeb0f6 (patch) | |
tree | 7a3352828a318bcf0126f50ac3d31c8b16540703 /src/common | |
parent | 9b9ef5a2c0ec8e66c7da24c4229d89a90a10e914 (diff) | |
download | kogata-64b9108a58d3483e9b63511c4cf74b12dceeb0f6.tar.gz kogata-64b9108a58d3483e9b63511c4cf74b12dceeb0f6.zip |
Change thread waiting technology. Slower but does not do crappy things like malloc at impractical places.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/libalgo/hashtbl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/libalgo/hashtbl.c b/src/common/libalgo/hashtbl.c index 7192bd4..ddc56e1 100644 --- a/src/common/libalgo/hashtbl.c +++ b/src/common/libalgo/hashtbl.c @@ -93,11 +93,11 @@ bool hashtbl_add(hashtbl_t *ht, void* key, void* v) { 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); + size_t slot = SLOT_OF_HASH(ht->hf(key), ht->size); + i->key = key; i->val = v; i->next = ht->items[slot]; |