--- a/libidu/idu-hash.c +++ b/libidu/idu-hash.c @@ -60,6 +60,15 @@ ht->ht_compare = hash_cmp; } +static void * +idu_hash_insert (struct hash_table* ht, void *item) +{ + void **slot = hash_find_slot (ht, item); + void *old_item = slot ? *slot : 0; + hash_insert_at (ht, item, slot); + return ((HASH_VACANT (old_item)) ? 0 : old_item); +} + /* Load an array of items into `ht'. */ void @@ -68,7 +77,7 @@ char *items = (char *) item_table; while (cardinality--) { - hash_insert (ht, items); + idu_hash_insert (ht, items); items += size; } } @@ -121,15 +130,6 @@ } void * -hash_insert (struct hash_table* ht, void *item) -{ - void **slot = hash_find_slot (ht, item); - void *old_item = slot ? *slot : 0; - hash_insert_at (ht, item, slot); - return ((HASH_VACANT (old_item)) ? 0 : old_item); -} - -void * hash_insert_at (struct hash_table* ht, void *item, void const *slot) { void *old_item = *(void **) slot; @@ -171,6 +171,7 @@ return 0; } +#if 0 // unused void hash_free_items (struct hash_table* ht) { @@ -215,6 +216,7 @@ ht->ht_vec = 0; ht->ht_capacity = 0; } +#endif void hash_map (struct hash_table *ht, hash_map_func_t map)