# HG changeset patch # User Timo Sirainen # Date 1147686454 -10800 # Node ID c7bcc970bf19f1e76aa99d50389126dd0a5d2708 # Parent 011f7c2b0ed0b646aa127e99042be42fd264cce1 Minor cleanup / memory reducement fix diff -r 011f7c2b0ed0 -r c7bcc970bf19 src/imap/imap-thread.c --- 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); } }