[dovecot-cvs] dovecot/src/lib hash.c,1.10,1.11

cras at procontrol.fi cras at procontrol.fi
Sat Jan 11 17:37:20 EET 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv7046

Modified Files:
	hash.c 
Log Message:
Few fixes



Index: hash.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/hash.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- hash.c	11 Jan 2003 15:29:46 -0000	1.10
+++ hash.c	11 Jan 2003 15:37:18 -0000	1.11
@@ -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;




More information about the dovecot-cvs mailing list