changeset 946:3681ff89f0e2 HEAD

Few fixes
author Timo Sirainen <tss@iki.fi>
date Sat, 11 Jan 2003 17:37:18 +0200
parents 501f076f2e74
children f5658274245f
files src/lib/hash.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/hash.c	Sat Jan 11 17:29:46 2003 +0200
+++ b/src/lib/hash.c	Sat Jan 11 17:37:18 2003 +0200
@@ -21,6 +21,10 @@
     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
+/* We have a primary hash consisting of just key/value entries. When collisions
+   occur, we move on to another hash (10% of the size of primary) which also
+   contains pointer to next collision, working as linked list. */
+
 /* @UNSAFE: whole file */
 
 #include "lib.h"
@@ -379,6 +383,8 @@
 		if (cnode->node.key != NULL || cnode->next != NULL)
 			hash_compress(table, i, 0);
 	}
+
+        table->removed_count = 0;
 }
 
 void hash_remove(struct hash_table *table, const void *key)
@@ -458,6 +464,7 @@
 void hash_thaw(struct hash_table *table)
 {
 	i_assert(table->frozen > 0);
+
 	if (--table->frozen > 0)
 		return;
 
@@ -472,7 +479,6 @@
 	struct hash_node *old_nodes;
 	struct collision_node *old_cnodes, *cnode;
 	size_t old_size, old_csize, i;
-
 	float nodes_per_list;
 
         nodes_per_list = (float) table->nodes_count / (float) table->size;