Matthew Barnes 971ea5
--- evolution-data-server-1.9.1/camel/camel-text-index.c.kill-ememory	2006-10-25 23:02:26.000000000 -0400
Matthew Barnes 971ea5
+++ evolution-data-server-1.9.1/camel/camel-text-index.c	2006-10-25 23:03:35.000000000 -0400
Matthew Barnes 971ea5
@@ -70,7 +70,7 @@
Matthew Barnes 971ea5
 struct _CamelTextIndexNamePrivate {
Matthew Barnes 971ea5
 	GString *buffer;
Matthew Barnes 971ea5
 	camel_key_t nameid;
Matthew Barnes 971ea5
-	EMemPool *pool;
Matthew Barnes 971ea5
+	GStringChunk *string_chunk;
Matthew Barnes 971ea5
 };
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 CamelTextIndexName *camel_text_index_name_new(CamelTextIndex *idx, const char *name, camel_key_t nameid);
Matthew Barnes 971ea5
@@ -1373,7 +1373,7 @@
Matthew Barnes 971ea5
 	struct _CamelTextIndexNamePrivate *p = ((CamelTextIndexName *)idn)->priv;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	if (g_hash_table_lookup(idn->words, word) == NULL) {
Matthew Barnes 971ea5
-		char *w = e_mempool_strdup(p->pool, word);
Matthew Barnes 971ea5
+		char *w = g_string_chunk_insert(p->string_chunk, word);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 		g_hash_table_insert(idn->words, w, w);
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
@@ -1501,7 +1501,7 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	p = idn->priv = g_malloc0(sizeof(*idn->priv));
Matthew Barnes 971ea5
 	p->buffer = g_string_new("");
Matthew Barnes 971ea5
-	p->pool = e_mempool_new(256, 128, E_MEMPOOL_ALIGN_BYTE);
Matthew Barnes 971ea5
+	p->string_chunk = g_string_chunk_new(256);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 static void
Matthew Barnes 971ea5
@@ -1512,7 +1512,7 @@
Matthew Barnes 971ea5
 	g_hash_table_destroy(idn->parent.words);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_string_free(p->buffer, TRUE);
Matthew Barnes 971ea5
-	e_mempool_destroy(p->pool);
Matthew Barnes 971ea5
+	g_string_chunk_free(p->string_chunk);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_free(p);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
@@ -1544,7 +1544,7 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	cin->index = (CamelIndex *)idx;
Matthew Barnes 971ea5
 	camel_object_ref((CamelObject *)idx);
Matthew Barnes 971ea5
-	cin->name = e_mempool_strdup(p->pool, name);
Matthew Barnes 971ea5
+	cin->name = g_string_chunk_insert(p->string_chunk, name);
Matthew Barnes 971ea5
 	p->nameid = nameid;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	return idn;
Matthew Barnes 971ea5
--- evolution-data-server-1.9.1/camel/camel-mime-parser.c.kill-ememory	2006-04-12 15:14:13.000000000 -0400
Matthew Barnes 971ea5
+++ evolution-data-server-1.9.1/camel/camel-mime-parser.c	2006-10-25 23:03:35.000000000 -0400
Matthew Barnes 971ea5
@@ -122,7 +122,7 @@
Matthew Barnes 971ea5
 	camel_mime_parser_state_t savestate; /* state at invocation of this part */
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 #ifdef MEMPOOL
Matthew Barnes 971ea5
-	EMemPool *pool;		/* memory pool to keep track of headers/etc at this level */
Matthew Barnes 971ea5
+	GStringChunk *string_chunk;  /* string chunk to keep track of headers/etc at this level */
Matthew Barnes 971ea5
 #endif
Matthew Barnes 971ea5
 	struct _camel_header_raw *headers;	/* headers for this part */
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
@@ -1001,7 +1001,8 @@
Matthew Barnes 971ea5
 		s->parts = h->parent;
Matthew Barnes 971ea5
 		g_free(h->boundary);
Matthew Barnes 971ea5
 #ifdef MEMPOOL
Matthew Barnes 971ea5
-		e_mempool_destroy(h->pool);
Matthew Barnes 971ea5
+		if (h->string_chunk != NULL)
Matthew Barnes 971ea5
+			g_string_chunk_free(h->string_chunk);
Matthew Barnes 971ea5
 #else
Matthew Barnes 971ea5
 		camel_header_raw_clear(&h->headers);
Matthew Barnes 971ea5
 #endif
Matthew Barnes 971ea5
@@ -1109,20 +1110,16 @@
Matthew Barnes 971ea5
 	content = strchr(header, ':');
Matthew Barnes 971ea5
 	if (content) {
Matthew Barnes 971ea5
 		register int len;
Matthew Barnes 971ea5
-		n = e_mempool_alloc(h->pool, sizeof(*n));
Matthew Barnes 971ea5
+		n = g_malloc(sizeof(*n));
Matthew Barnes 971ea5
 		n->next = NULL;
Matthew Barnes 971ea5
 		
Matthew Barnes 971ea5
 		len = content-header;
Matthew Barnes 971ea5
-		n->name = e_mempool_alloc(h->pool, len+1);
Matthew Barnes 971ea5
-		memcpy(n->name, header, len);
Matthew Barnes 971ea5
-		n->name[len] = 0;
Matthew Barnes 971ea5
+		n->name = g_string_chunk_insert_len(h->string_chunk, header, len);
Matthew Barnes 971ea5
 		
Matthew Barnes 971ea5
 		content++;
Matthew Barnes 971ea5
 		
Matthew Barnes 971ea5
 		len = s->outptr - content;
Matthew Barnes 971ea5
-		n->value = e_mempool_alloc(h->pool, len+1);
Matthew Barnes 971ea5
-		memcpy(n->value, content, len);
Matthew Barnes 971ea5
-		n->value[len] = 0;
Matthew Barnes 971ea5
+		n->value = g_string_chunk_insert_len(h->string_chunk, content, len);
Matthew Barnes 971ea5
 		
Matthew Barnes 971ea5
 		n->offset = offset;
Matthew Barnes 971ea5
 		
Matthew Barnes 971ea5
@@ -1180,7 +1177,7 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	h = g_malloc0(sizeof(*h));
Matthew Barnes 971ea5
 #ifdef MEMPOOL
Matthew Barnes 971ea5
-	h->pool = e_mempool_new(8192, 4096, E_MEMPOOL_ALIGN_STRUCT);
Matthew Barnes 971ea5
+	h->string_chunk = g_string_chunk_new(8192);
Matthew Barnes 971ea5
 #endif
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	if (s->parts)
Matthew Barnes 971ea5
--- evolution-data-server-1.9.1/camel/camel-vee-folder.c.kill-ememory	2006-04-12 15:14:13.000000000 -0400
Matthew Barnes 971ea5
+++ evolution-data-server-1.9.1/camel/camel-vee-folder.c	2006-10-25 23:03:35.000000000 -0400
Matthew Barnes 971ea5
@@ -28,10 +28,6 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 #include "libedataserver/md5-utils.h"
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-#if defined (DOEPOOLV) || defined (DOESTRV)
Matthew Barnes 971ea5
-#include "libedataserver/e-memory.h"
Matthew Barnes 971ea5
-#endif
Matthew Barnes 971ea5
-
Matthew Barnes 971ea5
 #include "camel-debug.h"
Matthew Barnes 971ea5
 #include "camel-exception.h"
Matthew Barnes 971ea5
 #include "camel-folder-search.h"
Matthew Barnes 971ea5
--- evolution-data-server-1.9.1/camel/camel-folder.c.kill-ememory	2006-10-25 23:02:26.000000000 -0400
Matthew Barnes 971ea5
+++ evolution-data-server-1.9.1/camel/camel-folder.c	2006-10-25 23:03:35.000000000 -0400
Matthew Barnes 971ea5
@@ -1890,7 +1890,7 @@
Matthew Barnes 971ea5
 struct _CamelFolderChangeInfoPrivate {
Matthew Barnes 971ea5
 	GHashTable *uid_stored;	/* what we have stored, which array they're in */
Matthew Barnes 971ea5
 	GHashTable *uid_source;	/* used to create unique lists */
Matthew Barnes 971ea5
-	struct _EMemPool *uid_pool;	/* pool used to store copies of uid strings */
Matthew Barnes 971ea5
+	GStringChunk *uid_string_chunk;  /* used to store copies of uid strings */
Matthew Barnes 971ea5
 };
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
@@ -1917,7 +1917,7 @@
Matthew Barnes 971ea5
 	info->priv = g_malloc0(sizeof(*info->priv));
Matthew Barnes 971ea5
 	info->priv->uid_stored = g_hash_table_new(g_str_hash, g_str_equal);
Matthew Barnes 971ea5
 	info->priv->uid_source = NULL;
Matthew Barnes 971ea5
-	info->priv->uid_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
Matthew Barnes 971ea5
+	info->priv->uid_string_chunk = g_string_chunk_new(512);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	return info;
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
@@ -1943,7 +1943,7 @@
Matthew Barnes 971ea5
 		p->uid_source = g_hash_table_new(g_str_hash, g_str_equal);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	if (g_hash_table_lookup(p->uid_source, uid) == NULL)
Matthew Barnes 971ea5
-		g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), GINT_TO_POINTER (1));
Matthew Barnes 971ea5
+		g_hash_table_insert(p->uid_source, g_string_chunk_insert(p->uid_string_chunk, uid), GINT_TO_POINTER (1));
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
@@ -1972,7 +1972,7 @@
Matthew Barnes 971ea5
 		char *uid = list->pdata[i];
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 		if (g_hash_table_lookup(p->uid_source, uid) == NULL)
Matthew Barnes 971ea5
-			g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), GINT_TO_POINTER (1));
Matthew Barnes 971ea5
+			g_hash_table_insert(p->uid_source, g_string_chunk_insert(p->uid_string_chunk, uid), GINT_TO_POINTER (1));
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
@@ -2132,7 +2132,7 @@
Matthew Barnes 971ea5
 		return;
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-	olduid = e_mempool_strdup(p->uid_pool, uid);
Matthew Barnes 971ea5
+	olduid = g_string_chunk_insert(p->uid_string_chunk, uid);
Matthew Barnes 971ea5
 	g_ptr_array_add(info->uid_added, olduid);
Matthew Barnes 971ea5
 	g_hash_table_insert(p->uid_stored, olduid, info->uid_added);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
@@ -2166,7 +2166,7 @@
Matthew Barnes 971ea5
 		return;
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-	olduid = e_mempool_strdup(p->uid_pool, uid);
Matthew Barnes 971ea5
+	olduid = g_string_chunk_insert(p->uid_string_chunk, uid);
Matthew Barnes 971ea5
 	g_ptr_array_add(info->uid_removed, olduid);
Matthew Barnes 971ea5
 	g_hash_table_insert(p->uid_stored, olduid, info->uid_removed);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
@@ -2195,7 +2195,7 @@
Matthew Barnes 971ea5
 		return;
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-	olduid = e_mempool_strdup(p->uid_pool, uid);
Matthew Barnes 971ea5
+	olduid = g_string_chunk_insert(p->uid_string_chunk, uid);
Matthew Barnes 971ea5
 	g_ptr_array_add(info->uid_changed, olduid);
Matthew Barnes 971ea5
 	g_hash_table_insert(p->uid_stored, olduid, info->uid_changed);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
@@ -2221,7 +2221,7 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	/* always add to recent, but dont let anyone else know */	
Matthew Barnes 971ea5
 	if (!g_hash_table_lookup_extended(p->uid_stored, uid, (void **)&olduid, (void **)&olduids)) {
Matthew Barnes 971ea5
-		olduid = e_mempool_strdup(p->uid_pool, uid);
Matthew Barnes 971ea5
+		olduid = g_string_chunk_insert(p->uid_string_chunk, uid);
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
 	g_ptr_array_add(info->uid_recent, olduid);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
@@ -2270,7 +2270,8 @@
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
 	g_hash_table_destroy(p->uid_stored);
Matthew Barnes 971ea5
 	p->uid_stored = g_hash_table_new(g_str_hash, g_str_equal);
Matthew Barnes 971ea5
-	e_mempool_flush(p->uid_pool, TRUE);
Matthew Barnes 971ea5
+	g_string_chunk_free(p->uid_string_chunk);
Matthew Barnes 971ea5
+	p->uid_string_chunk = g_string_chunk_new(512);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
@@ -2293,7 +2294,7 @@
Matthew Barnes 971ea5
 		g_hash_table_destroy(p->uid_source);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_hash_table_destroy(p->uid_stored);
Matthew Barnes 971ea5
-	e_mempool_destroy(p->uid_pool);
Matthew Barnes 971ea5
+	g_string_chunk_free(p->uid_string_chunk);
Matthew Barnes 971ea5
 	g_free(p);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_ptr_array_free(info->uid_added, TRUE);
Matthew Barnes 971ea5
--- evolution-data-server-1.9.1/camel/camel-folder-summary.c.kill-ememory	2006-07-24 09:40:46.000000000 -0400
Matthew Barnes 971ea5
+++ evolution-data-server-1.9.1/camel/camel-folder-summary.c	2006-10-25 23:03:35.000000000 -0400
Matthew Barnes 971ea5
@@ -134,10 +134,6 @@
Matthew Barnes 971ea5
 	s->message_info_chunks = NULL;
Matthew Barnes 971ea5
 	s->content_info_chunks = NULL;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-#if defined (DOESTRV) || defined (DOEPOOLV)
Matthew Barnes 971ea5
-	s->message_info_strings = CAMEL_MESSAGE_INFO_LAST;
Matthew Barnes 971ea5
-#endif
Matthew Barnes 971ea5
-
Matthew Barnes 971ea5
 	s->version = CAMEL_FOLDER_SUMMARY_VERSION;
Matthew Barnes 971ea5
 	s->flags = 0;
Matthew Barnes 971ea5
 	s->time = 0;
Matthew Barnes 971ea5
@@ -873,13 +869,6 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	CAMEL_SUMMARY_LOCK(s, summary_lock);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-/* unnecessary for pooled vectors */
Matthew Barnes 971ea5
-#ifdef DOESTRV
Matthew Barnes 971ea5
-	/* this is vitally important, and also if this is ever modified, then
Matthew Barnes 971ea5
-	   the hash table needs to be resynced */
Matthew Barnes 971ea5
-	info->strings = e_strv_pack(info->strings);
Matthew Barnes 971ea5
-#endif
Matthew Barnes 971ea5
-
Matthew Barnes 971ea5
 	g_ptr_array_add(s->messages, info);
Matthew Barnes 971ea5
 	g_hash_table_insert(s->messages_uid, (char *)camel_message_info_uid(info), info);
Matthew Barnes 971ea5
 	s->flags |= CAMEL_SUMMARY_DIRTY;
Matthew Barnes 971ea5
--- evolution-data-server-1.9.1/camel/providers/local/camel-maildir-summary.c.kill-ememory	2005-08-31 00:26:06.000000000 -0400
Matthew Barnes 971ea5
+++ evolution-data-server-1.9.1/camel/providers/local/camel-maildir-summary.c	2006-10-25 23:03:35.000000000 -0400
Matthew Barnes 971ea5
@@ -129,10 +129,6 @@
Matthew Barnes 971ea5
 	s->message_info_size = sizeof(CamelMaildirMessageInfo);
Matthew Barnes 971ea5
 	s->content_info_size = sizeof(CamelMaildirMessageContentInfo);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-#if defined (DOEPOOLV) || defined (DOESTRV)
Matthew Barnes 971ea5
-	s->message_info_strings = CAMEL_MAILDIR_INFO_LAST;
Matthew Barnes 971ea5
-#endif
Matthew Barnes 971ea5
-
Matthew Barnes 971ea5
 	if (gethostname(hostname, 256) == 0) {
Matthew Barnes 971ea5
 		o->priv->hostname = g_strdup(hostname);
Matthew Barnes 971ea5
 	} else {
Matthew Barnes 971ea5
@@ -329,11 +325,9 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 static void message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
Matthew Barnes 971ea5
 {
Matthew Barnes 971ea5
-#if !defined (DOEPOOLV) && !defined (DOESTRV)
Matthew Barnes 971ea5
 	CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *)mi;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_free(mdi->filename);
Matthew Barnes 971ea5
-#endif
Matthew Barnes 971ea5
 	((CamelFolderSummaryClass *) parent_class)->message_info_free(s, mi);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
@@ -412,7 +406,7 @@
Matthew Barnes 971ea5
 	struct dirent *d;
Matthew Barnes 971ea5
 	CamelMaildirSummary *mds = (CamelMaildirSummary *)cls;
Matthew Barnes 971ea5
 	char *uid;
Matthew Barnes 971ea5
-	EMemPool *pool;
Matthew Barnes 971ea5
+	GStringChunk *string_chunk;
Matthew Barnes 971ea5
 	int ret;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	cur = g_strdup_printf("%s/cur", cls->folder_path);
Matthew Barnes 971ea5
@@ -429,7 +423,7 @@
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	mds->priv->load_map = g_hash_table_new(g_str_hash, g_str_equal);
Matthew Barnes 971ea5
-	pool = e_mempool_new(1024, 512, E_MEMPOOL_ALIGN_BYTE);
Matthew Barnes 971ea5
+	string_chunk = g_string_chunk_new(1024);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	while ( (d = readdir(dir)) ) {
Matthew Barnes 971ea5
 		if (d->d_name[0] == '.')
Matthew Barnes 971ea5
@@ -438,13 +432,13 @@
Matthew Barnes 971ea5
 		/* map the filename -> uid */
Matthew Barnes 971ea5
 		uid = strchr(d->d_name, ':');
Matthew Barnes 971ea5
 		if (uid) {
Matthew Barnes 971ea5
-			int len = uid-d->d_name;
Matthew Barnes 971ea5
-			uid = e_mempool_alloc(pool, len+1);
Matthew Barnes 971ea5
-			memcpy(uid, d->d_name, len);
Matthew Barnes 971ea5
-			uid[len] = 0;
Matthew Barnes 971ea5
-			g_hash_table_insert(mds->priv->load_map, uid, e_mempool_strdup(pool, d->d_name));
Matthew Barnes 971ea5
+			char *cp = uid;
Matthew Barnes 971ea5
+			*cp = '\0';
Matthew Barnes 971ea5
+			uid = g_string_chunk_insert(string_chunk, uid);
Matthew Barnes 971ea5
+			*cp = ':';
Matthew Barnes 971ea5
+			g_hash_table_insert(mds->priv->load_map, uid, g_string_chunk_insert(string_chunk, d->d_name));
Matthew Barnes 971ea5
 		} else {
Matthew Barnes 971ea5
-			uid = e_mempool_strdup(pool, d->d_name);
Matthew Barnes 971ea5
+			uid = g_string_chunk_insert(string_chunk, d->d_name);
Matthew Barnes 971ea5
 			g_hash_table_insert(mds->priv->load_map, uid, uid);
Matthew Barnes 971ea5
 		}
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
@@ -455,7 +449,7 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_hash_table_destroy(mds->priv->load_map);
Matthew Barnes 971ea5
 	mds->priv->load_map = NULL;
Matthew Barnes 971ea5
-	e_mempool_destroy(pool);
Matthew Barnes 971ea5
+	g_string_chunk_free(string_chunk);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	return ret;
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
@@ -621,23 +615,8 @@
Matthew Barnes 971ea5
 			filename = camel_maildir_info_filename(mdi);
Matthew Barnes 971ea5
 			/* TODO: only store the extension in the mdi->filename struct, not the whole lot */
Matthew Barnes 971ea5
 			if (filename == NULL || strcmp(filename, d->d_name) != 0) {
Matthew Barnes 971ea5
-#ifdef DOESTRV
Matthew Barnes 971ea5
-#warning "cannot modify the estrv after its been setup, for mt-safe code"
Matthew Barnes 971ea5
-				CAMEL_SUMMARY_LOCK(s, summary_lock);
Matthew Barnes 971ea5
-				/* need to update the summary hash ref */
Matthew Barnes 971ea5
-				g_hash_table_remove(s->messages_uid, camel_message_info_uid(info));
Matthew Barnes 971ea5
-				info->strings = e_strv_set_ref(info->strings, CAMEL_MAILDIR_INFO_FILENAME, d->d_name);
Matthew Barnes 971ea5
-				info->strings = e_strv_pack(info->strings);
Matthew Barnes 971ea5
-				g_hash_table_insert(s->messages_uid, (char *)camel_message_info_uid(info), info);
Matthew Barnes 971ea5
-				CAMEL_SUMMARY_UNLOCK(s, summary_lock);
Matthew Barnes 971ea5
-#else
Matthew Barnes 971ea5
-# ifdef DOEPOOLV
Matthew Barnes 971ea5
-				info->strings = e_poolv_set(info->strings, CAMEL_MAILDIR_INFO_FILENAME, d->d_name, FALSE);
Matthew Barnes 971ea5
-# else	
Matthew Barnes 971ea5
 				g_free(mdi->filename);
Matthew Barnes 971ea5
 				mdi->filename = g_strdup(d->d_name);
Matthew Barnes 971ea5
-# endif
Matthew Barnes 971ea5
-#endif
Matthew Barnes 971ea5
 			}
Matthew Barnes 971ea5
 			camel_message_info_free(info);
Matthew Barnes 971ea5
 		}
Matthew Barnes 971ea5
@@ -727,9 +706,6 @@
Matthew Barnes 971ea5
 	int count, i;
Matthew Barnes 971ea5
 	CamelMessageInfo *info;
Matthew Barnes 971ea5
 	CamelMaildirMessageInfo *mdi;
Matthew Barnes 971ea5
-#ifdef DOESTRV
Matthew Barnes 971ea5
-	CamelFolderSummary *s = (CamelFolderSummary *)cls;
Matthew Barnes 971ea5
-#endif
Matthew Barnes 971ea5
 	char *name;
Matthew Barnes 971ea5
 	struct stat st;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
@@ -775,26 +751,8 @@
Matthew Barnes 971ea5
 					/* we'll assume it didn't work, but dont change anything else */
Matthew Barnes 971ea5
 					g_free(newname);
Matthew Barnes 971ea5
 				} else {
Matthew Barnes 971ea5
-					/* TODO: If this is made mt-safe, then this code could be a problem, since
Matthew Barnes 971ea5
-					   the estrv is being modified.
Matthew Barnes 971ea5
-					   Sigh, this may mean the maildir name has to be cached another way */
Matthew Barnes 971ea5
-#ifdef DOESTRV
Matthew Barnes 971ea5
-#warning "cannot modify the estrv after its been setup, for mt-safe code"
Matthew Barnes 971ea5
-					CAMEL_SUMMARY_LOCK(s, summary_lock);
Matthew Barnes 971ea5
-					/* need to update the summary hash ref */
Matthew Barnes 971ea5
-					g_hash_table_remove(s->messages_uid, camel_message_info_uid(info));
Matthew Barnes 971ea5
-					info->strings = e_strv_set_ref_free(info->strings, CAMEL_MAILDIR_INFO_FILENAME, newname);
Matthew Barnes 971ea5
-					info->strings = e_strv_pack(info->strings);
Matthew Barnes 971ea5
-					g_hash_table_insert(s->messages_uid, (char *)camel_message_info_uid(info), info);
Matthew Barnes 971ea5
-					CAMEL_SUMMARY_UNLOCK(s, summary_lock);
Matthew Barnes 971ea5
-#else
Matthew Barnes 971ea5
-# ifdef DOEPOOLV
Matthew Barnes 971ea5
-					info->strings = e_poolv_set(info->strings, CAMEL_MAILDIR_INFO_FILENAME, newname, TRUE);
Matthew Barnes 971ea5
-# else
Matthew Barnes 971ea5
 					g_free(mdi->filename);
Matthew Barnes 971ea5
 					mdi->filename = newname;
Matthew Barnes 971ea5
-# endif
Matthew Barnes 971ea5
-#endif
Matthew Barnes 971ea5
 				}
Matthew Barnes 971ea5
 				g_free(name);
Matthew Barnes 971ea5
 				g_free(dest);
Matthew Barnes 971ea5
--- evolution-data-server-1.9.1/camel/camel-folder-search.c.kill-ememory	2006-06-08 21:21:50.000000000 -0400
Matthew Barnes 971ea5
+++ evolution-data-server-1.9.1/camel/camel-folder-search.c	2006-10-25 23:03:35.000000000 -0400
Matthew Barnes 971ea5
@@ -52,7 +52,7 @@
Matthew Barnes 971ea5
 #define r(x) 
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 struct _CamelFolderSearchPrivate {
Matthew Barnes 971ea5
-	GHashTable *mempool_hash;
Matthew Barnes 971ea5
+	GHashTable *string_chunk_hash;
Matthew Barnes 971ea5
 	CamelException *ex;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	CamelFolderThread *threads;
Matthew Barnes 971ea5
@@ -122,23 +122,23 @@
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	obj->sexp = e_sexp_new();
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-	/* use a hash of mempools to associate the returned uid lists with
Matthew Barnes 971ea5
-	   the backing mempool.  yes pretty weird, but i didn't want to change
Matthew Barnes 971ea5
-	   the api just yet */
Matthew Barnes 971ea5
+	/* use a hash of string chunks to associate the returned uid lists
Matthew Barnes 971ea5
+	 * with the backing string chunk.  yes pretty weird, but i didn't
Matthew Barnes 971ea5
+	 * want to change the api just yet */
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-	p->mempool_hash = g_hash_table_new(0, 0);
Matthew Barnes 971ea5
+	p->string_chunk_hash = g_hash_table_new(0, 0);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 static void
Matthew Barnes 971ea5
-free_mempool(void *key, void *value, void *data)
Matthew Barnes 971ea5
+free_string_chunk (void *key, void *value, void *data)
Matthew Barnes 971ea5
 {
Matthew Barnes 971ea5
 	GPtrArray *uids = key;
Matthew Barnes 971ea5
-	EMemPool *pool = value;
Matthew Barnes 971ea5
+	GStringChunk *string_chunk = value;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_warning("Search closed with outstanding result unfreed: %p", uids);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_ptr_array_free(uids, TRUE);
Matthew Barnes 971ea5
-	e_mempool_destroy(pool);
Matthew Barnes 971ea5
+	g_string_chunk_free(string_chunk);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 static void
Matthew Barnes 971ea5
@@ -153,8 +153,8 @@
Matthew Barnes 971ea5
 		g_hash_table_destroy(search->summary_hash);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_free(search->last_search);
Matthew Barnes 971ea5
-	g_hash_table_foreach(p->mempool_hash, free_mempool, obj);
Matthew Barnes 971ea5
-	g_hash_table_destroy(p->mempool_hash);
Matthew Barnes 971ea5
+	g_hash_table_foreach(p->string_chunk_hash, free_string_chunk, obj);
Matthew Barnes 971ea5
+	g_hash_table_destroy(p->string_chunk_hash);
Matthew Barnes 971ea5
 	g_free(p);
Matthew Barnes 971ea5
 }
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
@@ -344,7 +344,7 @@
Matthew Barnes 971ea5
 	GPtrArray *matches;
Matthew Barnes 971ea5
 	int i;
Matthew Barnes 971ea5
 	GHashTable *results;
Matthew Barnes 971ea5
-	EMemPool *pool;
Matthew Barnes 971ea5
+	GStringChunk *string_chunk;
Matthew Barnes 971ea5
 	struct _CamelFolderSearchPrivate *p = _PRIVATE(search);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	p->ex = ex;
Matthew Barnes 971ea5
@@ -373,11 +373,7 @@
Matthew Barnes 971ea5
 	/* now create a folder summary to return?? */
Matthew Barnes 971ea5
 	if (r->type == ESEXP_RES_ARRAY_PTR) {
Matthew Barnes 971ea5
 		d(printf("got result ...\n"));
Matthew Barnes 971ea5
-		/* we use a mempool to store the strings, packed in tight as possible, and freed together */
Matthew Barnes 971ea5
-		/* because the strings are often short (like <8 bytes long), we would be wasting appx 50%
Matthew Barnes 971ea5
-		   of memory just storing the size tag that malloc assigns us and alignment padding, so this
Matthew Barnes 971ea5
-		   gets around that (and is faster to allocate and free as a bonus) */
Matthew Barnes 971ea5
-		pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
Matthew Barnes 971ea5
+		string_chunk = g_string_chunk_new(512);
Matthew Barnes 971ea5
 		if (search->summary) {
Matthew Barnes 971ea5
 			/* reorder result in summary order */
Matthew Barnes 971ea5
 			results = g_hash_table_new(g_str_hash, g_str_equal);
Matthew Barnes 971ea5
@@ -389,20 +385,21 @@
Matthew Barnes 971ea5
 				CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
Matthew Barnes 971ea5
 				char *uid = (char *)camel_message_info_uid(info);
Matthew Barnes 971ea5
 				if (g_hash_table_lookup(results, uid)) {
Matthew Barnes 971ea5
-					g_ptr_array_add(matches, e_mempool_strdup(pool, uid));
Matthew Barnes 971ea5
+					g_ptr_array_add(matches, g_string_chunk_insert(string_chunk, uid));
Matthew Barnes 971ea5
 				}
Matthew Barnes 971ea5
 			}
Matthew Barnes 971ea5
 			g_hash_table_destroy(results);
Matthew Barnes 971ea5
 		} else {
Matthew Barnes 971ea5
 			for (i=0;i<r->value.ptrarray->len;i++) {
Matthew Barnes 971ea5
 				d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
Matthew Barnes 971ea5
-				g_ptr_array_add(matches, e_mempool_strdup(pool, g_ptr_array_index(r->value.ptrarray, i)));
Matthew Barnes 971ea5
+				g_ptr_array_add(matches, g_string_chunk_insert(string_chunk, g_ptr_array_index(r->value.ptrarray, i)));
Matthew Barnes 971ea5
 			}
Matthew Barnes 971ea5
 		}
Matthew Barnes 971ea5
-		/* instead of putting the mempool_hash in the structure, we keep the api clean by
Matthew Barnes 971ea5
-		   putting a reference to it in a hashtable.  Lets us do some debugging and catch
Matthew Barnes 971ea5
-		   unfree'd results as well. */
Matthew Barnes 971ea5
-		g_hash_table_insert(p->mempool_hash, matches, pool);
Matthew Barnes 971ea5
+		/* instead of putting the string_chunk_hash in the structure,
Matthew Barnes 971ea5
+		 * we keep the api clean by putting a reference to it in a
Matthew Barnes 971ea5
+		 * hashtable.  Lets us do some debugging and catch unfree'd
Matthew Barnes 971ea5
+		 * results as well. */
Matthew Barnes 971ea5
+		g_hash_table_insert(p->string_chunk_hash, matches, string_chunk);
Matthew Barnes 971ea5
 	} else {
Matthew Barnes 971ea5
 		g_warning("Search returned an invalid result type");
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
@@ -443,7 +440,7 @@
Matthew Barnes 971ea5
 	GPtrArray *matches = NULL, *summary_set;
Matthew Barnes 971ea5
 	int i;
Matthew Barnes 971ea5
 	GHashTable *results;
Matthew Barnes 971ea5
-	EMemPool *pool;
Matthew Barnes 971ea5
+	GStringChunk *string_chunk;
Matthew Barnes 971ea5
 	struct _CamelFolderSearchPrivate *p = _PRIVATE(search);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
 	g_assert(search->folder);
Matthew Barnes 971ea5
@@ -495,12 +492,7 @@
Matthew Barnes 971ea5
 	/* now create a folder summary to return?? */
Matthew Barnes 971ea5
 	if (r->type == ESEXP_RES_ARRAY_PTR) {
Matthew Barnes 971ea5
 		d(printf("got result ...\n"));
Matthew Barnes 971ea5
-
Matthew Barnes 971ea5
-		/* we use a mempool to store the strings, packed in tight as possible, and freed together */
Matthew Barnes 971ea5
-		/* because the strings are often short (like <8 bytes long), we would be wasting appx 50%
Matthew Barnes 971ea5
-		   of memory just storing the size tag that malloc assigns us and alignment padding, so this
Matthew Barnes 971ea5
-		   gets around that (and is faster to allocate and free as a bonus) */
Matthew Barnes 971ea5
-		pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
Matthew Barnes 971ea5
+		string_chunk = g_string_chunk_new(512);
Matthew Barnes 971ea5
 		/* reorder result in summary order */
Matthew Barnes 971ea5
 		results = g_hash_table_new(g_str_hash, g_str_equal);
Matthew Barnes 971ea5
 		for (i=0;i<r->value.ptrarray->len;i++) {
Matthew Barnes 971ea5
@@ -512,14 +504,15 @@
Matthew Barnes 971ea5
 			CamelMessageInfo *info = g_ptr_array_index(summary_set, i);
Matthew Barnes 971ea5
 			char *uid = (char *)camel_message_info_uid(info);
Matthew Barnes 971ea5
 			if (g_hash_table_lookup(results, uid))
Matthew Barnes 971ea5
-				g_ptr_array_add(matches, e_mempool_strdup(pool, uid));
Matthew Barnes 971ea5
+				g_ptr_array_add(matches, g_string_chunk_insert(string_chunk, uid));
Matthew Barnes 971ea5
 		}
Matthew Barnes 971ea5
 		g_hash_table_destroy(results);
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-		/* instead of putting the mempool_hash in the structure, we keep the api clean by
Matthew Barnes 971ea5
-		   putting a reference to it in a hashtable.  Lets us do some debugging and catch
Matthew Barnes 971ea5
-		   unfree'd results as well. */
Matthew Barnes 971ea5
-		g_hash_table_insert(p->mempool_hash, matches, pool);
Matthew Barnes 971ea5
+		/* instead of putting the string_chunk_hash in the structure,
Matthew Barnes 971ea5
+		 * we keep the api clean by putting a reference to it in a
Matthew Barnes 971ea5
+		 * hashtable.  Lets us do some debugging and catch unfree'd
Matthew Barnes 971ea5
+		 * results as well. */
Matthew Barnes 971ea5
+		g_hash_table_insert(p->string_chunk_hash, matches, string_chunk);
Matthew Barnes 971ea5
 	} else {
Matthew Barnes 971ea5
 		g_warning("Search returned an invalid result type");
Matthew Barnes 971ea5
 	}
Matthew Barnes 971ea5
@@ -552,12 +545,12 @@
Matthew Barnes 971ea5
 {
Matthew Barnes 971ea5
 	int i;
Matthew Barnes 971ea5
 	struct _CamelFolderSearchPrivate *p = _PRIVATE(search);
Matthew Barnes 971ea5
-	EMemPool *pool;
Matthew Barnes 971ea5
+	GStringChunk *string_chunk;
Matthew Barnes 971ea5
 
Matthew Barnes 971ea5
-	pool = g_hash_table_lookup(p->mempool_hash, result);
Matthew Barnes 971ea5
-	if (pool) {
Matthew Barnes 971ea5
-		e_mempool_destroy(pool);
Matthew Barnes 971ea5
-		g_hash_table_remove(p->mempool_hash, result);
Matthew Barnes 971ea5
+	string_chunk = g_hash_table_lookup(p->string_chunk_hash, result);
Matthew Barnes 971ea5
+	if (string_chunk) {
Matthew Barnes 971ea5
+		g_string_chunk_free(string_chunk);
Matthew Barnes 971ea5
+		g_hash_table_remove(p->string_chunk_hash, result);
Matthew Barnes 971ea5
 	} else {
Matthew Barnes 971ea5
 		for (i=0;i<result->len;i++)
Matthew Barnes 971ea5
 			g_free(g_ptr_array_index(result, i));