aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-04-26 09:09:05 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-04-26 09:09:05 +0800
commit7d9faeb00c03ec6af1c9f7f378123b57a9804de6 (patch)
treea233574f475b487a13b28f0d117ceca5ee56888e
parent36cac270be19b769530a7b68ca6d4e3b79452e41 (diff)
downloadgsoc2013-evolution-7d9faeb00c03ec6af1c9f7f378123b57a9804de6.tar
gsoc2013-evolution-7d9faeb00c03ec6af1c9f7f378123b57a9804de6.tar.gz
gsoc2013-evolution-7d9faeb00c03ec6af1c9f7f378123b57a9804de6.tar.bz2
gsoc2013-evolution-7d9faeb00c03ec6af1c9f7f378123b57a9804de6.tar.lz
gsoc2013-evolution-7d9faeb00c03ec6af1c9f7f378123b57a9804de6.tar.xz
gsoc2013-evolution-7d9faeb00c03ec6af1c9f7f378123b57a9804de6.tar.zst
gsoc2013-evolution-7d9faeb00c03ec6af1c9f7f378123b57a9804de6.zip
Applied jacob's patches for e-poolv stuff.
2001-04-26 Not Zed <NotZed@Ximian.com> * Applied jacob's patches for e-poolv stuff. svn path=/trunk/; revision=9571
-rw-r--r--camel/ChangeLog4
-rw-r--r--camel/camel-folder-summary.c131
-rw-r--r--camel/camel-folder-summary.h17
-rw-r--r--camel/camel-object.c2
-rw-r--r--camel/camel-vee-folder.c7
-rw-r--r--camel/providers/local/camel-maildir-summary.c22
-rw-r--r--camel/providers/local/camel-maildir-summary.h6
7 files changed, 122 insertions, 67 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index c431ed688d..760e6ff120 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,7 @@
+2001-04-26 Not Zed <NotZed@Ximian.com>
+
+ * Applied jacob's patches for e-poolv stuff.
+
2001-04-23 Jeffrey Stedfast <fejj@ximian.com>
* camel.h: Add camel-vee-folder.h and camel-digest-folder.h
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 69444641cd..2627007294 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -153,7 +153,7 @@ camel_folder_summary_init (CamelFolderSummary *s)
s->message_info_chunks = NULL;
s->content_info_chunks = NULL;
-#ifdef DOESTRV
+#if defined (DOESTRV) || defined (DOEPOOLV)
s->message_info_strings = CAMEL_MESSAGE_INFO_LAST;
#endif
@@ -706,6 +706,7 @@ void camel_folder_summary_add(CamelFolderSummary *s, CamelMessageInfo *info)
CAMEL_SUMMARY_LOCK(s, summary_lock);
+/* unnecessary for pooled vectors */
#ifdef DOESTRV
/* this is vitally important, and also if this is ever modified, then
the hash table needs to be resynced */
@@ -1671,6 +1672,9 @@ camel_folder_summary_info_new(CamelFolderSummary *s)
CAMEL_SUMMARY_UNLOCK(s, alloc_lock);
memset(mi, 0, s->message_info_size);
+#ifdef DOEPOOLV
+ mi->strings = e_poolv_new (s->message_info_strings);
+#endif
#ifdef DOESTRV
mi->strings = e_strv_new(s->message_info_strings);
#endif
@@ -1711,27 +1715,36 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
struct _header_references *refs, *scan;
char *msgid;
int count;
+ char *subject, *from, *to, *cc, *mlist;
mi = camel_folder_summary_info_new(s);
-#ifdef DOESTRV
- msgid = camel_folder_summary_format_string(h, "subject");
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, msgid);
- msgid = camel_folder_summary_format_address(h, "from");
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_FROM, msgid);
- msgid = camel_folder_summary_format_address(h, "to");
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_TO, msgid);
- msgid = camel_folder_summary_format_address(h, "cc");
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_CC, msgid);
- msgid = header_raw_check_mailing_list(&h);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_MLIST, msgid);
+ subject = camel_folder_summary_format_string(h, "subject");
+ from = camel_folder_summary_format_address(h, "from");
+ to = camel_folder_summary_format_address(h, "to");
+ cc = camel_folder_summary_format_address(h, "cc");
+ mlist = header_raw_check_mailing_list(&h);
+
+#ifdef DOEPOOLV
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, subject, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_FROM, from, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_TO, to, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_CC, cc, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_MLIST, mlist, TRUE);
+#elif defined (DOESTRV)
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, subject);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_FROM, from);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_TO, to);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_CC, cc);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_MLIST, mlist);
#else
- mi->subject = camel_folder_summary_format_string(h, "subject");
- mi->from = camel_folder_summary_format_address(h, "from");
- mi->to = camel_folder_summary_format_address(h, "to");
- mi->cc = camel_folder_summary_format_address(h, "cc");
- mi->mlist = header_raw_check_mailing_list(&h);
+ mi->subject = subject;
+ mi->from = from;
+ mi->to = to;
+ mi->cc = cc;
+ mi->mlist = mlist;
#endif
+
mi->user_flags = NULL;
mi->user_tags = NULL;
mi->date_sent = header_decode_date(header_raw_find(&h, "date", NULL), NULL);
@@ -1780,42 +1793,46 @@ message_info_load(CamelFolderSummary *s, FILE *in)
CamelMessageInfo *mi;
guint count;
int i;
-#ifdef DOESTRV
- char *tmp;
-#endif
+ char *subject, *from, *to, *cc, *mlist, *uid;;
mi = camel_folder_summary_info_new(s);
io(printf("Loading message info\n"));
-#ifdef DOESTRV
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_UID, tmp);
+
+ camel_folder_summary_decode_string(in, &uid);
camel_folder_summary_decode_uint32(in, &mi->flags);
camel_folder_summary_decode_uint32(in, &mi->size);
camel_folder_summary_decode_time_t(in, &mi->date_sent);
camel_folder_summary_decode_time_t(in, &mi->date_received);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, tmp);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_FROM, tmp);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_TO, tmp);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_CC, tmp);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_MLIST, tmp);
+ camel_folder_summary_decode_string(in, &subject);
+ camel_folder_summary_decode_string(in, &from);
+ camel_folder_summary_decode_string(in, &to);
+ camel_folder_summary_decode_string(in, &cc);
+ camel_folder_summary_decode_string(in, &mlist);
+
+#ifdef DOEPOOLV
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_UID, uid, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, subject, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_FROM, from, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_TO, to, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_CC, cc, TRUE);
+ e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_MLIST, mlist, TRUE);
+#elif defined (DOESTRV)
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_UID, uid);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, subject);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_FROM, from);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_TO, to);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_CC, cc);
+ e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_MLIST, mlist);
#else
- camel_folder_summary_decode_string(in, &mi->uid);
- camel_folder_summary_decode_uint32(in, &mi->flags);
- camel_folder_summary_decode_uint32(in, &mi->size);
- camel_folder_summary_decode_time_t(in, &mi->date_sent);
- camel_folder_summary_decode_time_t(in, &mi->date_received);
- camel_folder_summary_decode_string(in, &mi->subject);
- camel_folder_summary_decode_string(in, &mi->from);
- camel_folder_summary_decode_string(in, &mi->to);
- camel_folder_summary_decode_string(in, &mi->cc);
- camel_folder_summary_decode_string(in, &mi->mlist);
+ mi->uid = uid;
+ mi->subject = subject;
+ mi->from = from;
+ mi->to = to;
+ mi->cc = cc;
+ mi->mlist = mlist;
#endif
+
mi->content = NULL;
camel_folder_summary_decode_fixed_int32(in, &mi->message_id.id.part.hi);
@@ -1921,7 +1938,9 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
static void
message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
{
-#ifdef DOESTRV
+#ifdef DOEPOOLV
+ e_poolv_destroy(mi->strings);
+#elif defined (DOESTRV)
e_strv_destroy(mi->strings);
#else
g_free(mi->uid);
@@ -2515,6 +2534,9 @@ camel_message_info_new (void)
CamelMessageInfo *info;
info = g_malloc0(sizeof(*info));
+#ifdef DOEPOOLV
+ info->strings = e_poolv_new(CAMEL_MESSAGE_INFO_LAST);
+#endif
#ifdef DOESTRV
info->strings = e_strv_new (CAMEL_MESSAGE_INFO_LAST);
#endif
@@ -2591,8 +2613,10 @@ camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to)
to->refcount = 1;
/* Copy strings */
-#ifdef DOESTRV
- to->strings = e_strv_new(CAMEL_MESSAGE_INFO_LAST);
+#ifdef DOEPOOLV
+ e_poolv_cpy (to->strings, from->strings);
+#elif defined (DOESTRV)
+ /* to->strings = e_strv_new(CAMEL_MESSAGE_INFO_LAST); */
e_strv_set(to->strings, CAMEL_MESSAGE_INFO_SUBJECT, camel_message_info_subject(from));
e_strv_set(to->strings, CAMEL_MESSAGE_INFO_FROM, camel_message_info_from(from));
e_strv_set(to->strings, CAMEL_MESSAGE_INFO_TO, camel_message_info_to(from));
@@ -2661,7 +2685,9 @@ camel_message_info_free(CamelMessageInfo *mi)
}
GLOBAL_INFO_UNLOCK(info);
-#ifdef DOESTRV
+#ifdef DOEPOOLV
+ e_poolv_destroy(mi->strings);
+#elif defined (DOESTRV)
e_strv_destroy(mi->strings);
#else
g_free(mi->uid);
@@ -2678,19 +2704,26 @@ camel_message_info_free(CamelMessageInfo *mi)
g_free(mi);
}
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
const char *camel_message_info_string(const CamelMessageInfo *mi, int type)
{
if (mi->strings == NULL)
return "";
+#ifdef DOEPOOLV
+ return e_poolv_get(mi->strings, type);
+#else
return e_strv_get(mi->strings, type);
+#endif
}
void camel_message_info_set_string(CamelMessageInfo *mi, int type, char *str)
{
g_assert(mi->strings != NULL);
-
+#ifdef DOEPOOLV
+ e_poolv_set(mi->strings, type, str, TRUE);
+#else
mi->strings = e_strv_set_ref_free(mi->strings, type, str);
+#endif
}
#endif
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 99642c9a84..eb1a527a47 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -93,9 +93,12 @@ typedef struct _CamelSummaryReferences {
CamelSummaryMessageID references[1];
} CamelSummaryReferences;
-#define DOESTRV
+/* #define DOESTRV */
+#define DOEPOOLV
+
+#if defined (DOEPOOLV) || defined (DOESTRV)
+#include "../e-util/e-memory.h"
-#ifdef DOESTRV
/* string array indices */
enum {
CAMEL_MESSAGE_INFO_UID,
@@ -111,7 +114,9 @@ enum {
/* information about a given object */
struct _CamelMessageInfo {
/* public fields */
-#ifdef DOESTRV
+#ifdef DOEPOOLV
+ EPoolv *strings;
+#elif defined (DOESTRV)
struct _EStrv *strings; /* all strings packed into a single compact array */
#else
char *subject;
@@ -121,7 +126,7 @@ struct _CamelMessageInfo {
char *mlist;
char *uid;
-#endif
+#endif /* DOEPOOLV */
guint32 flags;
guint32 size;
guint32 refcount;
@@ -159,7 +164,7 @@ struct _CamelFolderSummary {
guint32 message_info_size;
guint32 content_info_size;
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
guint32 message_info_strings;
#endif
/* memory allocators (setup automatically) */
@@ -297,7 +302,7 @@ void camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *t
void camel_message_info_free(CamelMessageInfo *mi);
/* accessors */
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
const char *camel_message_info_string(const CamelMessageInfo *mi, int type);
#define camel_message_info_subject(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_SUBJECT)
#define camel_message_info_from(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_FROM)
diff --git a/camel/camel-object.c b/camel/camel-object.c
index bdb17fa177..7f53a68bfe 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -336,8 +336,10 @@ obj_finalize (CamelObject * obj)
obj->s.magic = CAMEL_OBJECT_FINALIZED_VALUE;
if (obj->event_to_hooklist) {
+#if 0
g_hash_table_foreach (obj->event_to_hooklist, (GHFunc) g_free,
NULL);
+#endif
g_hash_table_destroy (obj->event_to_hooklist);
obj->event_to_hooklist = NULL;
}
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 13b15c3b30..7fdef39272 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -38,7 +38,7 @@
#include "e-util/md5-utils.h"
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
#include "e-util/e-memory.h"
#endif
@@ -488,6 +488,7 @@ vee_search_by_expression(CamelFolder *folder, const char *expression, CamelExcep
node = g_list_next(node);
}
+ g_free(expr);
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
g_hash_table_destroy(searched);
@@ -572,7 +573,9 @@ vee_folder_add_info(CamelVeeFolder *vf, CamelFolder *f, CamelMessageInfo *info,
mi = (CamelVeeMessageInfo *)camel_folder_summary_info_new(folder->summary);
camel_message_info_dup_to(info, (CamelMessageInfo *)mi);
-#ifdef DOESTRV
+#ifdef DOEPOOLV
+ mi->info.strings = e_poolv_set(mi->info.strings, CAMEL_MESSAGE_INFO_UID, uid, TRUE);
+#elif defined (DOESTRV)
mi->info.strings = e_strv_set_ref_free(mi->info.strings, CAMEL_MESSAGE_INFO_UID, uid);
mi->info.strings = e_strv_pack(mi->info.strings);
#else
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index e2ce0f4e97..5d65b02a5e 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -125,7 +125,7 @@ camel_maildir_summary_init (CamelMaildirSummary *o)
s->message_info_size = sizeof(CamelMaildirMessageInfo);
s->content_info_size = sizeof(CamelMaildirMessageContentInfo);
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
s->message_info_strings = CAMEL_MAILDIR_INFO_LAST;
#endif
@@ -310,7 +310,7 @@ static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _header
static void message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
{
-#ifndef DOESTRV
+#if !defined (DOEPOOLV) && !defined (DOESTRV)
CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *)mi;
g_free(mdi->filename);
@@ -580,19 +580,23 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
filename = camel_maildir_info_filename(mdi);
/* TODO: only store the extension in the mdi->filename struct, not the whole lot */
if (filename == NULL || strcmp(filename, d->d_name) != 0) {
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
#warning "cannot modify the estrv after its been setup, for mt-safe code"
d(printf("filename changed: %s to %s\n", filename, d->d_name));
/* need to update the summary hash string reference since it might (will) change */
CAMEL_SUMMARY_LOCK(s, summary_lock);
g_hash_table_remove(s->messages_uid, uid);
+#ifdef DOEPOOLV
+ info->strings = e_poolv_set(info->strings, CAMEL_MAILDIR_INFO_FILENAME, d->d_name, FALSE);
+#else
info->strings = e_strv_set_ref(info->strings, CAMEL_MAILDIR_INFO_FILENAME, d->d_name);
/* we need to re-pack as well */
info->strings = e_strv_pack(info->strings);
+#endif /* DOEPOOLV */
g_hash_table_insert(s->messages_uid, (char *)camel_message_info_uid(info), info);
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-#else
+#else /* defined (DOEPOOLV) || defined (DOESTRV) */
g_free(mdi->filename);
mdi->filename = g_strdup(d->d_name);
#endif
@@ -677,7 +681,7 @@ maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChange
int count, i;
CamelMessageInfo *info;
CamelMaildirMessageInfo *mdi;
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
CamelFolderSummary *s = (CamelFolderSummary *)cls;
#endif
char *name;
@@ -728,16 +732,20 @@ maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChange
/* TODO: If this is made mt-safe, then this code could be a problem, since
the estrv is being modified.
Sigh, this may mean the maildir name has to be cached another way */
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
#warning "cannot modify the estrv after its been setup, for mt-safe code"
CAMEL_SUMMARY_LOCK(s, summary_lock);
/* need to update the summary hash ref */
g_hash_table_remove(s->messages_uid, camel_message_info_uid(info));
+#ifdef DOEPOOLV
+ info->strings = e_poolv_set(info->strings, CAMEL_MAILDIR_INFO_FILENAME, newname, TRUE);
+#else
info->strings = e_strv_set_ref_free(info->strings, CAMEL_MAILDIR_INFO_FILENAME, newname);
info->strings = e_strv_pack(info->strings);
+#endif /* DOEPOOLV */
g_hash_table_insert(s->messages_uid, (char *)camel_message_info_uid(info), info);
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-#else
+#else /* defined (DOEPOOLV) || defined (DOESTRV) */
g_free(mdi->filename);
mdi->filename = newname;
#endif
diff --git a/camel/providers/local/camel-maildir-summary.h b/camel/providers/local/camel-maildir-summary.h
index 456492b5e5..a42692671c 100644
--- a/camel/providers/local/camel-maildir-summary.h
+++ b/camel/providers/local/camel-maildir-summary.h
@@ -37,7 +37,7 @@ typedef struct _CamelMaildirMessageContentInfo {
CamelMessageContentInfo info;
} CamelMaildirMessageContentInfo;
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
enum {
CAMEL_MAILDIR_INFO_FILENAME = CAMEL_MESSAGE_INFO_LAST,
CAMEL_MAILDIR_INFO_LAST,
@@ -47,7 +47,7 @@ enum {
typedef struct _CamelMaildirMessageInfo {
CamelMessageInfo info;
-#ifndef DOESTRV
+#if !defined (DOEPOOLV) && !defined (DOESTRV)
char *filename; /* maildir has this annoying status shit on the end of the filename, use this to get the real message id */
#endif
} CamelMaildirMessageInfo;
@@ -72,7 +72,7 @@ CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char
char *camel_maildir_summary_info_to_name(const CamelMessageInfo *info);
int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name);
-#ifdef DOESTRV
+#if defined (DOEPOOLV) || defined (DOESTRV)
#define camel_maildir_info_filename(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MAILDIR_INFO_FILENAME)
#define camel_maildir_info_set_filename(x, s) camel_message_info_set_string((CamelMessageInfo *)(x), CAMEL_MAILDIR_INFO_FILENAME, s)
#else