dovecot-1.2: hash2: minor code cleanup.

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 5 12:40:34 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/f15ce57d84d1
changeset: 8154:f15ce57d84d1
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Sep 05 12:40:28 2008 +0300
description:
hash2: minor code cleanup.

diffstat:

1 file changed, 4 insertions(+), 6 deletions(-)
src/lib/hash2.c |   10 ++++------

diffs (41 lines):

diff -r 30fedb49296e -r f15ce57d84d1 src/lib/hash2.c
--- a/src/lib/hash2.c	Fri Sep 05 12:40:01 2008 +0300
+++ b/src/lib/hash2.c	Fri Sep 05 12:40:28 2008 +0300
@@ -185,8 +185,7 @@ void *hash2_insert_hash(struct hash2_tab
 }
 
 static void
-hash2_remove_value_p(struct hash2_table *hash, struct hash2_value **valuep,
-		     bool allow_resize)
+hash2_remove_value_p(struct hash2_table *hash, struct hash2_value **valuep)
 {
 	struct hash2_value *deleted_value;
 
@@ -197,8 +196,6 @@ hash2_remove_value_p(struct hash2_table 
 	hash->deleted_values = deleted_value;
 
 	hash->count--;
-	if (allow_resize)
-		hash2_resize(hash, FALSE);
 }
 
 void hash2_remove(struct hash2_table *hash, const void *key)
@@ -211,7 +208,8 @@ void hash2_remove(struct hash2_table *ha
 	while (*valuep != NULL) {
 		if ((*valuep)->key_hash == key_hash &&
 		    hash->key_compare_cb(key, (*valuep) + 1, hash->context)) {
-			hash2_remove_value_p(hash, valuep, TRUE);
+			hash2_remove_value_p(hash, valuep);
+			hash2_resize(hash, FALSE);
 			return;
 		}
 		valuep = &(*valuep)->next;
@@ -230,7 +228,7 @@ void hash2_remove_iter(struct hash2_tabl
 			next = (*valuep)->next;
 			/* don't allow resizing, otherwise iterating would
 			   break completely */
-			hash2_remove_value_p(hash, valuep, FALSE);
+			hash2_remove_value_p(hash, valuep);
 			iter->next_value = next;
 			return;
 		}


More information about the dovecot-cvs mailing list