changeset 4273:c7bcc970bf19 HEAD

Minor cleanup / memory reducement fix
author Timo Sirainen <timo.sirainen@movial.fi>
date Mon, 15 May 2006 12:47:34 +0300
parents 011f7c2b0ed0
children bd519db7f6e5
files src/imap/imap-thread.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/imap-thread.c	Mon May 15 11:00:10 2006 +0300
+++ b/src/imap/imap-thread.c	Mon May 15 12:47:34 2006 +0300
@@ -353,6 +353,11 @@
 		}
 	}
 
+	if (child->parent->parent == NULL) {
+		/* unlinking from root */
+		ctx->root_count--;
+	}
+
 	child->next = NULL;
 	if (!add_to_root)
 		child->parent = NULL;
@@ -414,8 +419,7 @@
 }
 
 static void link_message(struct thread_context *ctx,
-			 const char *parent_msgid, const char *child_msgid,
-			 bool replace)
+			 const char *parent_msgid, const char *child_msgid)
 {
 	struct node *child;
 
@@ -423,7 +427,7 @@
 	if (child == NULL)
 		child = create_node(ctx, child_msgid);
 
-	link_node(ctx, parent_msgid, child, replace);
+	link_node(ctx, parent_msgid, child, FALSE);
 }
 
 static bool link_references(struct thread_context *ctx,
@@ -436,7 +440,7 @@
 		return FALSE;
 
 	while ((child_id = get_msgid(&references)) != NULL) {
-		link_message(ctx, parent_id, child_id, FALSE);
+		link_message(ctx, parent_id, child_id);
 		parent_id = child_id;
 	}
 
@@ -471,7 +475,7 @@
 			link_node(ctx, refid, node, TRUE);
 		else {
 			/* no references, make sure it's not linked */
-			if (node != NULL && NODE_HAS_PARENT(ctx, node))
+			if (NODE_HAS_PARENT(ctx, node))
 				unlink_child(ctx, node, TRUE);
 		}
 	}