diff options
author | Miles Bader <miles@gnu.org> | 1995-08-07 17:36:52 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-08-07 17:36:52 +0000 |
commit | a325fedf5741b6b16a6b60458c70b7a46d5894d0 (patch) | |
tree | a0bc1bd79eb82c86c809922bfbc41a2dc28c1af6 /libihash | |
parent | 6430e733ad662ad8db534e4020c7b6da73b2d3b4 (diff) |
(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.
Diffstat (limited to 'libihash')
-rw-r--r-- | libihash/ihash.c | 21 |
1 files changed, 3 insertions, 18 deletions
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 |