From a325fedf5741b6b16a6b60458c70b7a46d5894d0 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 7 Aug 1995 17:36:52 +0000 Subject: (ihash_locp_remove): Get rid of the optimization to use HASH_EMPTY instead of HASH_DEL when the next position on the chain is empty -- different hash chains may share this cell, and have different next positions, leading to random additional entries sometimes disappearing when deleting something. --- libihash/ihash.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'libihash/ihash.c') diff --git a/libihash/ihash.c b/libihash/ihash.c index 92f29ecb..43be0550 100644 --- a/libihash/ihash.c +++ b/libihash/ihash.c @@ -256,24 +256,9 @@ ihash_iterate(ihash_t ht, error_t (*fun)(void *)) void ihash_locp_remove(ihash_t ht, void **locp) { - void *tag = HASH_DEL; - - if (ht != NULL) - { - int index = locp - ht->tab; - int next_index = REHASH(ht, ht->ids[index], index); - - if (ht && ht->cleanup) - ht->cleanup(*locp, ht->cleanup_arg); - - /* If the next position in this hash chain is empty, then we don't need - to use HASH_DEL (which only serves to prevent breaking the chain to - preserve lookups past this point). */ - if (ht->tab[next_index] == HASH_EMPTY) - tag = HASH_EMPTY; - } - - *locp = tag; + if (ht && ht->cleanup) + ht->cleanup(*locp, ht->cleanup_arg); + *locp = HASH_DEL; } /* Remove the entry with a key of ID from HT. If anything was actually -- cgit v1.2.3