| 1 |
--- a/libidu/idu-hash.c |
| 2 |
+++ b/libidu/idu-hash.c |
| 3 |
@@ -60,6 +60,15 @@ |
| 4 |
ht->ht_compare = hash_cmp; |
| 5 |
} |
| 6 |
|
| 7 |
+static void * |
| 8 |
+idu_hash_insert (struct hash_table* ht, void *item) |
| 9 |
+{ |
| 10 |
+ void **slot = hash_find_slot (ht, item); |
| 11 |
+ void *old_item = slot ? *slot : 0; |
| 12 |
+ hash_insert_at (ht, item, slot); |
| 13 |
+ return ((HASH_VACANT (old_item)) ? 0 : old_item); |
| 14 |
+} |
| 15 |
+ |
| 16 |
/* Load an array of items into `ht'. */ |
| 17 |
|
| 18 |
void |
| 19 |
@@ -68,7 +77,7 @@ |
| 20 |
char *items = (char *) item_table; |
| 21 |
while (cardinality--) |
| 22 |
{ |
| 23 |
- hash_insert (ht, items); |
| 24 |
+ idu_hash_insert (ht, items); |
| 25 |
items += size; |
| 26 |
} |
| 27 |
} |
| 28 |
@@ -121,15 +130,6 @@ |
| 29 |
} |
| 30 |
|
| 31 |
void * |
| 32 |
-hash_insert (struct hash_table* ht, void *item) |
| 33 |
-{ |
| 34 |
- void **slot = hash_find_slot (ht, item); |
| 35 |
- void *old_item = slot ? *slot : 0; |
| 36 |
- hash_insert_at (ht, item, slot); |
| 37 |
- return ((HASH_VACANT (old_item)) ? 0 : old_item); |
| 38 |
-} |
| 39 |
- |
| 40 |
-void * |
| 41 |
hash_insert_at (struct hash_table* ht, void *item, void const *slot) |
| 42 |
{ |
| 43 |
void *old_item = *(void **) slot; |
| 44 |
@@ -171,6 +171,7 @@ |
| 45 |
return 0; |
| 46 |
} |
| 47 |
|
| 48 |
+#if 0 // unused |
| 49 |
void |
| 50 |
hash_free_items (struct hash_table* ht) |
| 51 |
{ |
| 52 |
@@ -215,6 +216,7 @@ |
| 53 |
ht->ht_vec = 0; |
| 54 |
ht->ht_capacity = 0; |
| 55 |
} |
| 56 |
+#endif |
| 57 |
|
| 58 |
void |
| 59 |
hash_map (struct hash_table *ht, hash_map_func_t map) |