aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-05-07 15:08:09 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-05-07 15:08:09 +0800
commit4e919deeff40049f3ca1dda409d21ea84f7700bd (patch)
treecdfc42e2141a824966f86522d59e03ad1bda5d28 /camel
parent27176351ae38247a7b7c656e73727d704b12c63e (diff)
downloadgsoc2013-evolution-4e919deeff40049f3ca1dda409d21ea84f7700bd.tar
gsoc2013-evolution-4e919deeff40049f3ca1dda409d21ea84f7700bd.tar.gz
gsoc2013-evolution-4e919deeff40049f3ca1dda409d21ea84f7700bd.tar.bz2
gsoc2013-evolution-4e919deeff40049f3ca1dda409d21ea84f7700bd.tar.lz
gsoc2013-evolution-4e919deeff40049f3ca1dda409d21ea84f7700bd.tar.xz
gsoc2013-evolution-4e919deeff40049f3ca1dda409d21ea84f7700bd.tar.zst
gsoc2013-evolution-4e919deeff40049f3ca1dda409d21ea84f7700bd.zip
properly set the parent nodes for the re-parented phantom-node children.
2004-05-07 Not Zed <NotZed@Ximian.com> * camel-folder-thread.c (thread_summary): properly set the parent nodes for the re-parented phantom-node children. Wasn't that fun to debug! * camel-folder-thread.h: make order and re bitfields, saves 4 bytes/node. svn path=/trunk/; revision=25822
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog9
-rw-r--r--camel/camel-folder-thread.c30
-rw-r--r--camel/camel-folder-thread.h4
3 files changed, 33 insertions, 10 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 864fafa413..bcd209d453 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,12 @@
+2004-05-07 Not Zed <NotZed@Ximian.com>
+
+ * camel-folder-thread.c (thread_summary): properly set the parent
+ nodes for the re-parented phantom-node children. Wasn't that fun
+ to debug!
+
+ * camel-folder-thread.h: make order and re bitfields, saves 4
+ bytes/node.
+
2004-05-06 Not Zed <NotZed@Ximian.com>
* providers/imap/camel-imap-store.c (connect_to_server): set
diff --git a/camel/camel-folder-thread.c b/camel/camel-folder-thread.c
index a67ab5d5b2..a110cdb28e 100644
--- a/camel/camel-folder-thread.c
+++ b/camel/camel-folder-thread.c
@@ -37,7 +37,8 @@
#include "camel-folder-thread.h"
#include "e-util/e-memory.h"
-#define d(x)
+#define d(x)
+#define m(x)
/*#define TIMEIT*/
@@ -114,6 +115,7 @@ prune_empty(CamelFolderThread *thread, CamelFolderThreadNode **cp)
if (c->child == NULL) {
d(printf("removing empty node\n"));
lastc->next = c->next;
+ m(memset(c, 0xfe, sizeof(*c)));
e_memchunk_free(thread->node_chunks, c);
continue;
}
@@ -151,13 +153,13 @@ hashloop(void *key, void *value, void *data)
}
static char *
-get_root_subject(CamelFolderThreadNode *c, int *re)
+get_root_subject(CamelFolderThreadNode *c)
{
char *s, *p;
CamelFolderThreadNode *scan;
s = NULL;
- *re = FALSE;
+ c->re = FALSE;
if (c->message)
s = (char *)camel_message_info_subject(c->message);
else {
@@ -183,7 +185,7 @@ get_root_subject(CamelFolderThreadNode *c, int *re)
while (isdigit(*p) || (ispunct(*p) && (*p != ':')))
p++;
if (*p==':') {
- *re = TRUE;
+ c->re = TRUE;
s = p+1;
} else
break;
@@ -235,7 +237,7 @@ group_root_set(CamelFolderThread *thread, CamelFolderThreadNode **cp)
clast = (CamelFolderThreadNode *)cp;
c = clast->next;
while (c) {
- c->root_subject = get_root_subject(c, &c->re);
+ c->root_subject = get_root_subject(c);
if (c->root_subject) {
container = g_hash_table_lookup(subject_table, c->root_subject);
if (container == NULL
@@ -264,6 +266,7 @@ group_root_set(CamelFolderThread *thread, CamelFolderThreadNode **cp)
scan = scan->next;
scan->next = c->child;
clast->next = c->next;
+ m(memset(c, 0xee, sizeof(*c)));
e_memchunk_free(thread->node_chunks, c);
continue;
} if (c->message == NULL && container->message != NULL) {
@@ -521,17 +524,25 @@ thread_summary(CamelFolderThread *thread, GPtrArray *summary)
child = c->next;
if (child->message == NULL) {
newtop = child->child;
+ newtop->parent = NULL;
/* unlink pseudo node */
c->next = newtop;
- /* link its siblings onto the end of its children */
+ /* link its siblings onto the end of its children, fix all parent pointers */
scan = (CamelFolderThreadNode *)&newtop->child;
- while (scan->next)
+ while (scan->next) {
scan = scan->next;
+ }
scan->next = newtop->next;
+ while (scan->next) {
+ scan = scan->next;
+ scan->parent = newtop;
+ }
+
/* and link the now 'real' node into the list */
newtop->next = child->next;
c = newtop;
+ m(memset(child, 0xde, sizeof(*child)));
e_memchunk_free(thread->node_chunks, child);
} else {
c = child;
@@ -544,6 +555,8 @@ thread_summary(CamelFolderThread *thread, GPtrArray *summary)
c = c->next;
if (c->message == NULL)
g_warning("threading missed removing a pseudo node: %s\n", c->root_subject);
+ if (c->parent != NULL)
+ g_warning("base node has a non-null parent: %s\n", c->root_subject);
}
thread->tree = head;
@@ -616,7 +629,8 @@ camel_folder_thread_messages_new (CamelFolder *folder, GPtrArray *uids, gboolean
thread_summary(thread, summary);
- g_hash_table_destroy(wanted);
+ if (wanted)
+ g_hash_table_destroy(wanted);
return thread;
}
diff --git a/camel/camel-folder-thread.h b/camel/camel-folder-thread.h
index 8bb78e27a0..9e51016708 100644
--- a/camel/camel-folder-thread.h
+++ b/camel/camel-folder-thread.h
@@ -36,8 +36,8 @@ typedef struct _CamelFolderThreadNode {
*child;
const CamelMessageInfo *message;
char *root_subject; /* cached root equivalent subject */
- int re; /* re version of subject? */
- int order;
+ guint32 order:31;
+ guint32 re:1; /* re version of subject? */
} CamelFolderThreadNode;
typedef struct _CamelFolderThread {