[dovecot-cvs] dovecot/src/imap imap-thread.c,1.6,1.7

cras at procontrol.fi cras at procontrol.fi
Wed Dec 3 02:40:23 EET 2003


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv14047/imap

Modified Files:
	imap-thread.c 
Log Message:
Changed hash_foreach() to iterator.



Index: imap-thread.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/imap-thread.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- imap-thread.c	26 Oct 2003 20:13:15 -0000	1.6
+++ imap-thread.c	3 Dec 2003 00:40:21 -0000	1.7
@@ -898,21 +898,21 @@
 	(void)o_stream_send(ctx->output, str_data(str), str_len(str));
 }
 
-static void save_root_cb(void *key __attr_unused__, void *value, void *context)
-{
-	struct thread_context *ctx = context;
-	struct node *node = value;
-
-	if (node->parent == NULL)
-		add_root(ctx, node);
-}
-
 static void mail_thread_finish(struct thread_context *ctx)
 {
+	struct hash_iterate_context *iter;
+	void *key, *value;
 	struct node *node;
 
 	/* (2) save root nodes and drop the msgids */
-	hash_foreach(ctx->msgid_hash, save_root_cb, ctx);
+	iter = hash_iterate_init(ctx->msgid_hash);
+	while (hash_iterate(iter, &key, &value)) {
+		struct node *node = value;
+
+		if (node->parent == NULL)
+			add_root(ctx, node);
+	}
+	hash_iterate_deinit(iter);
 
 	/* drop the memory allocated for message-IDs and msgid_hash,
 	   reuse their memory for base subjects */



More information about the dovecot-cvs mailing list