[dovecot-cvs] dovecot/src/lib hash.c,1.26,1.27
tss at dovecot.org
tss at dovecot.org
Fri Jan 26 00:44:16 UTC 2007
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv31970
Modified Files:
hash.c
Log Message:
Optimization: Hash compression didn't remove NULL nodes from roots.
Index: hash.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/hash.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- hash.c 26 Aug 2006 13:56:05 -0000 1.26
+++ hash.c 26 Jan 2007 00:44:09 -0000 1.27
@@ -269,12 +269,12 @@
(void)hash_insert_node(table, key, value, TRUE);
}
-static void hash_compress(struct hash_table *table, struct hash_node *node)
+static void hash_compress(struct hash_table *table, struct hash_node *root)
{
- struct hash_node *next;
+ struct hash_node *node, *next;
/* remove deleted nodes from the list */
- while (node->next != NULL) {
+ for (node = root; node->next != NULL; ) {
next = node->next;
if (next->key == NULL) {
@@ -286,9 +286,9 @@
}
/* update root */
- if (node->key == NULL && node->next != NULL) {
- next = node->next;
- memcpy(node, next, sizeof(*node));
+ if (root->key == NULL && root->next != NULL) {
+ next = root->next;
+ *root = *next;
free_node(table, next);
}
}
More information about the dovecot-cvs
mailing list