Re: CamelObject with gslice
Philip Van Hoof <[email protected]> Wed, 18 Oct 2006 14:34:12 +0200
| Newsgroups | gmane.comp.gnome.evolution.patches |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2006-10-18 at 14:06 +0200, Philip Van Hoof wrote: > On Tue, 2006-10-17 at 21:41 -0400, Matthew Barnes wrote: > > On Wed, 2006-10-18 at 02:58 +0200, Philip Van Hoof wrote: > The camel-folder-summary.c/h might not immediately apply on your version > because the offsets in the diff will differ between your and my version. > That file has indeed been changed intensively by the mmap patch that is > of course applied to my version (and probably not yet to yours). This is the right file that contains both the patch for the .c and the .h file. -- Philip Van Hoof, software developer home: me at pvanhoof dot be gnome: pvanhoof at gnome dot org work: vanhoof at x-tend dot be blog: http://pvanhoof.be/blog _______________________________________________ Evolution-patches mailing list [email protected] http://mail.gnome.org/mailman/listinfo/evolution-patches
camel-folder-summary.ch.diff
(text/x-patch, 2.2 KB)
Index: camel-folder-summary.c
===================================================================
--- camel-folder-summary.c (revision 1014)
+++ camel-folder-summary.c (working copy)
@@ -127,7 +127,6 @@
s->message_info_size = sizeof(CamelMessageInfoBase);
s->content_info_size = sizeof(CamelMessageContentInfo);
- s->message_info_chunks = NULL;
s->content_info_chunks = NULL;
#if defined (DOESTRV) || defined (DOEPOOLV)
@@ -157,6 +156,12 @@
}
static void
+foreach_msginfo (gpointer data, gpointer user_data)
+{
+ g_slice_free1 ((gint)user_data, data);
+}
+
+static void
camel_folder_summary_finalize (CamelObject *obj)
{
struct _CamelFolderSummaryPrivate *p;
@@ -165,11 +170,11 @@
p = _PRIVATE(obj);
camel_folder_summary_clear(s);
-
if (s->file)
g_mapped_file_free (s->file);
s->file = NULL;
-
+
+ g_ptr_array_foreach (s->messages, foreach_msginfo, (gpointer)s->message_info_size);
g_ptr_array_free(s->messages, TRUE);
g_hash_table_destroy(s->messages_uid);
@@ -178,8 +183,6 @@
g_free(s->summary_path);
- if (s->message_info_chunks)
- e_memchunk_destroy(s->message_info_chunks);
if (s->content_info_chunks)
e_memchunk_destroy(s->content_info_chunks);
@@ -1987,10 +1990,7 @@
g_free(mi->references);
- if (s)
- e_memchunk_free(s->message_info_chunks, mi);
- else
- g_free(mi);
+ g_slice_free1 (s->message_info_size, mi);
}
static CamelMessageContentInfo *
@@ -2735,12 +2735,10 @@
if (s) {
CAMEL_SUMMARY_LOCK(s, alloc_lock);
- if (s->message_info_chunks == NULL)
- s->message_info_chunks = e_memchunk_new(32, s->message_info_size);
- info = e_memchunk_alloc0(s->message_info_chunks);
+ info = g_slice_alloc0 (s->message_info_size);
CAMEL_SUMMARY_UNLOCK(s, alloc_lock);
} else {
- info = g_malloc0(sizeof(CamelMessageInfoBase));
+ info = g_slice_alloc0 (s->message_info_size);
}
info->refcount = 1;
Index: camel-folder-summary.h
===================================================================
--- camel-folder-summary.h (revision 1014)
+++ camel-folder-summary.h (working copy)
@@ -224,7 +224,6 @@
guint32 content_info_size;
/* memory allocators (setup automatically) */
- struct _EMemChunk *message_info_chunks;
struct _EMemChunk *content_info_chunks;
char *summary_path;