[evolution-data-server] Deprecate EMemPool, add CamelMemPool.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Deprecate EMemPool, add CamelMemPool.
- Date: Sun, 28 Mar 2010 16:05:10 +0000 (UTC)
commit f52b21fee81bf929d376997448ab7b50d5b0cbb5
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Mar 28 12:04:25 2010 -0400
Deprecate EMemPool, add CamelMemPool.
.gitignore | 1 +
camel/Makefile.am | 2 +
camel/camel-folder.c | 25 ++--
camel/camel-mempool.c | 220 +++++++++++++++++++++++++
camel/camel-mempool.h | 71 ++++++++
camel/camel-mime-parser.c | 15 +-
camel/camel-text-index.c | 13 +-
camel/camel.h | 1 +
camel/providers/imapx/camel-imapx-utils.c | 1 -
camel/providers/local/camel-maildir-summary.c | 15 +-
docs/reference/camel/camel-docs.sgml | 6 +
docs/reference/camel/camel-sections.txt | 15 ++-
docs/reference/camel/tmpl/camel-mempool.sgml | 85 ++++++++++
docs/reference/camel/tmpl/camel-store.sgml | 7 +
libedataserver/e-memory.h | 2 +
15 files changed, 439 insertions(+), 40 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index b3c57c3..383a45a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,6 +63,7 @@
/po/Makefile.in
/po/Makefile.in.in
/po/POTFILES
+/po/evolution-data-server-2.30.pot
/po/stamp-it
/so_locations
/stamp-h1
diff --git a/camel/Makefile.am b/camel/Makefile.am
index d04c829..4f7e5bf 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -183,6 +183,7 @@ libcamel_1_2_la_SOURCES = \
camel-list-utils.c \
camel-lock.c \
camel-medium.c \
+ camel-mempool.c \
camel-mime-filter-basic.c \
camel-mime-filter-bestenc.c \
camel-mime-filter-canon.c \
@@ -256,6 +257,7 @@ libcamelinclude_HEADERS = \
camel-lock-client.h \
camel-lock.h \
camel-medium.h \
+ camel-mempool.h \
camel-mime-filter-basic.h \
camel-mime-filter-bestenc.h \
camel-mime-filter-canon.h \
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 26da733..e9a280b 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -31,13 +31,12 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
-#include <libedataserver/e-memory.h>
-
#include "camel-db.h"
#include "camel-debug.h"
#include "camel-exception.h"
#include "camel-filter-driver.h"
#include "camel-folder.h"
+#include "camel-mempool.h"
#include "camel-mime-message.h"
#include "camel-operation.h"
#include "camel-private.h"
@@ -2050,7 +2049,7 @@ struct _CamelFolderChangeInfoPrivate {
GHashTable *uid_stored; /* what we have stored, which array they're in */
GHashTable *uid_source; /* used to create unique lists */
GPtrArray *uid_filter; /* uids to be filtered */
- struct _EMemPool *uid_pool; /* pool used to store copies of uid strings */
+ CamelMemPool *uid_pool; /* pool used to store copies of uid strings */
};
/* Event hooks that block emission when frozen */
@@ -2224,7 +2223,7 @@ camel_folder_change_info_new(void)
info->priv->uid_stored = g_hash_table_new(g_str_hash, g_str_equal);
info->priv->uid_source = NULL;
info->priv->uid_filter = g_ptr_array_new();
- info->priv->uid_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
+ info->priv->uid_pool = camel_mempool_new(512, 256, CAMEL_MEMPOOL_ALIGN_BYTE);
return info;
}
@@ -2249,7 +2248,7 @@ camel_folder_change_info_add_source(CamelFolderChangeInfo *info, const gchar *ui
p->uid_source = g_hash_table_new(g_str_hash, g_str_equal);
if (g_hash_table_lookup(p->uid_source, uid) == NULL)
- g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), GINT_TO_POINTER (1));
+ g_hash_table_insert(p->uid_source, camel_mempool_strdup(p->uid_pool, uid), GINT_TO_POINTER (1));
}
/**
@@ -2277,7 +2276,7 @@ camel_folder_change_info_add_source_list(CamelFolderChangeInfo *info, const GPtr
gchar *uid = list->pdata[i];
if (g_hash_table_lookup(p->uid_source, uid) == NULL)
- g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), GINT_TO_POINTER (1));
+ g_hash_table_insert(p->uid_source, camel_mempool_strdup(p->uid_pool, uid), GINT_TO_POINTER (1));
}
}
@@ -2386,7 +2385,7 @@ change_info_recent_uid(CamelFolderChangeInfo *info, const gchar *uid)
/* always add to recent, but dont let anyone else know */
if (!g_hash_table_lookup_extended(p->uid_stored, uid, (gpointer *)&olduid, (gpointer *)&olduids)) {
- olduid = e_mempool_strdup(p->uid_pool, uid);
+ olduid = camel_mempool_strdup(p->uid_pool, uid);
}
g_ptr_array_add(info->uid_recent, olduid);
}
@@ -2402,7 +2401,7 @@ change_info_filter_uid(CamelFolderChangeInfo *info, const gchar *uid)
/* always add to filter, but dont let anyone else know */
if (!g_hash_table_lookup_extended(p->uid_stored, uid, (gpointer *)&olduid, (gpointer *)&olduids)) {
- olduid = e_mempool_strdup(p->uid_pool, uid);
+ olduid = camel_mempool_strdup(p->uid_pool, uid);
}
g_ptr_array_add(p->uid_filter, olduid);
}
@@ -2466,7 +2465,7 @@ camel_folder_change_info_add_uid(CamelFolderChangeInfo *info, const gchar *uid)
return;
}
- olduid = e_mempool_strdup(p->uid_pool, uid);
+ olduid = camel_mempool_strdup(p->uid_pool, uid);
g_ptr_array_add(info->uid_added, olduid);
g_hash_table_insert(p->uid_stored, olduid, info->uid_added);
}
@@ -2499,7 +2498,7 @@ camel_folder_change_info_remove_uid(CamelFolderChangeInfo *info, const gchar *ui
return;
}
- olduid = e_mempool_strdup(p->uid_pool, uid);
+ olduid = camel_mempool_strdup(p->uid_pool, uid);
g_ptr_array_add(info->uid_removed, olduid);
g_hash_table_insert(p->uid_stored, olduid, info->uid_removed);
}
@@ -2527,7 +2526,7 @@ camel_folder_change_info_change_uid(CamelFolderChangeInfo *info, const gchar *ui
return;
}
- olduid = e_mempool_strdup(p->uid_pool, uid);
+ olduid = camel_mempool_strdup(p->uid_pool, uid);
g_ptr_array_add(info->uid_changed, olduid);
g_hash_table_insert(p->uid_stored, olduid, info->uid_changed);
}
@@ -2594,7 +2593,7 @@ camel_folder_change_info_clear(CamelFolderChangeInfo *info)
g_hash_table_destroy(p->uid_stored);
p->uid_stored = g_hash_table_new(g_str_hash, g_str_equal);
g_ptr_array_set_size(p->uid_filter, 0);
- e_mempool_flush(p->uid_pool, TRUE);
+ camel_mempool_flush(p->uid_pool, TRUE);
}
/**
@@ -2617,7 +2616,7 @@ camel_folder_change_info_free(CamelFolderChangeInfo *info)
g_hash_table_destroy(p->uid_stored);
g_ptr_array_free(p->uid_filter, TRUE);
- e_mempool_destroy(p->uid_pool);
+ camel_mempool_destroy(p->uid_pool);
g_slice_free (struct _CamelFolderChangeInfoPrivate, p);
g_ptr_array_free(info->uid_added, TRUE);
diff --git a/camel/camel-mempool.c b/camel/camel-mempool.c
new file mode 100644
index 0000000..5cd3160
--- /dev/null
+++ b/camel/camel-mempool.c
@@ -0,0 +1,220 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "camel-mempool.h"
+
+#include <string.h>
+
+typedef struct _MemPoolNode {
+ struct _MemPoolNode *next;
+
+ gint free;
+} MemPoolNode;
+
+typedef struct _MemPoolThresholdNode {
+ struct _MemPoolThresholdNode *next;
+} MemPoolThresholdNode;
+
+#define ALIGNED_SIZEOF(t) ((sizeof (t) + G_MEM_ALIGN - 1) & -G_MEM_ALIGN)
+
+struct _CamelMemPool {
+ gint blocksize;
+ gint threshold;
+ guint align;
+ struct _MemPoolNode *blocks;
+ struct _MemPoolThresholdNode *threshold_blocks;
+};
+
+/**
+ * camel_mempool_new:
+ * @blocksize: The base blocksize to use for all system alocations.
+ * @threshold: If the allocation exceeds the threshold, then it is
+ * allocated separately and stored in a separate list.
+ * @flags: Alignment options: CAMEL_MEMPOOL_ALIGN_STRUCT uses native
+ * struct alignment, CAMEL_MEMPOOL_ALIGN_WORD aligns to 16 bits (2 bytes),
+ * and CAMEL_MEMPOOL_ALIGN_BYTE aligns to the nearest byte. The default
+ * is to align to native structures.
+ *
+ * Create a new mempool header. Mempools can be used to efficiently
+ * allocate data which can then be freed as a whole.
+ *
+ * Mempools can also be used to efficiently allocate arbitrarily
+ * aligned data (such as strings) without incurring the space overhead
+ * of aligning each allocation (which is not required for strings).
+ *
+ * However, each allocation cannot be freed individually, only all
+ * or nothing.
+ *
+ * Returns:
+ *
+ * Since: 3.0
+ **/
+CamelMemPool *
+camel_mempool_new (gint blocksize,
+ gint threshold,
+ CamelMemPoolFlags flags)
+{
+ CamelMemPool *pool;
+
+ pool = g_slice_new0 (CamelMemPool);
+ if (threshold >= blocksize)
+ threshold = blocksize * 2 / 3;
+ pool->blocksize = blocksize;
+ pool->threshold = threshold;
+ pool->blocks = NULL;
+ pool->threshold_blocks = NULL;
+
+ switch (flags & CAMEL_MEMPOOL_ALIGN_MASK) {
+ case CAMEL_MEMPOOL_ALIGN_STRUCT:
+ default:
+ pool->align = G_MEM_ALIGN-1;
+ break;
+ case CAMEL_MEMPOOL_ALIGN_WORD:
+ pool->align = 2-1;
+ break;
+ case CAMEL_MEMPOOL_ALIGN_BYTE:
+ pool->align = 1-1;
+ }
+ return pool;
+}
+
+/**
+ * camel_mempool_alloc:
+ * @pool: a #CamelMemPool
+ * @size:
+ *
+ * Allocate a new data block in the mempool. Size will
+ * be rounded up to the mempool's alignment restrictions
+ * before being used.
+ *
+ * Since: 3.0
+ **/
+gpointer
+camel_mempool_alloc (CamelMemPool *pool,
+ register gint size)
+{
+ size = (size + pool->align) & (~(pool->align));
+ if (size>=pool->threshold) {
+ MemPoolThresholdNode *n;
+
+ n = g_malloc (ALIGNED_SIZEOF (*n) + size);
+ n->next = pool->threshold_blocks;
+ pool->threshold_blocks = n;
+ return (gchar *) n + ALIGNED_SIZEOF (*n);
+ } else {
+ register MemPoolNode *n;
+
+ n = pool->blocks;
+ if (n && n->free >= size) {
+ n->free -= size;
+ return (gchar *) n + ALIGNED_SIZEOF (*n) + n->free;
+ }
+
+ /* maybe we could do some sort of the free blocks based on size, but
+ it doubt its worth it at all */
+
+ n = g_malloc (ALIGNED_SIZEOF (*n) + pool->blocksize);
+ n->next = pool->blocks;
+ pool->blocks = n;
+ n->free = pool->blocksize - size;
+ return (gchar *) n + ALIGNED_SIZEOF (*n) + n->free;
+ }
+}
+
+/**
+ * camel_mempool_strdup:
+ * @pool: a #CamelMemPool
+ * @str:
+ *
+ * Since: 3.0
+ **/
+gchar *
+camel_mempool_strdup (CamelMemPool *pool,
+ const gchar *str)
+{
+ gchar *out;
+
+ out = camel_mempool_alloc (pool, strlen (str) + 1);
+ strcpy (out, str);
+
+ return out;
+}
+
+/**
+ * camel_mempool_flush:
+ * @pool: a #CamelMemPool
+ * @freeall: free all system allocated blocks as well
+ *
+ * Flush used memory and mark allocated blocks as free.
+ *
+ * If @freeall is #TRUE, then all allocated blocks are free'd
+ * as well. Otherwise only blocks above the threshold are
+ * actually freed, and the others are simply marked as empty.
+ *
+ * Since: 3.0
+ **/
+void
+camel_mempool_flush (CamelMemPool *pool,
+ gint freeall)
+{
+ MemPoolThresholdNode *tn, *tw;
+ MemPoolNode *pw, *pn;
+
+ tw = pool->threshold_blocks;
+ while (tw) {
+ tn = tw->next;
+ g_free (tw);
+ tw = tn;
+ }
+ pool->threshold_blocks = NULL;
+
+ if (freeall) {
+ pw = pool->blocks;
+ while (pw) {
+ pn = pw->next;
+ g_free (pw);
+ pw = pn;
+ }
+ pool->blocks = NULL;
+ } else {
+ pw = pool->blocks;
+ while (pw) {
+ pw->free = pool->blocksize;
+ pw = pw->next;
+ }
+ }
+}
+
+/**
+ * camel_mempool_destroy:
+ * @pool: a #CamelMemPool
+ *
+ * Free all memory associated with a mempool.
+ *
+ * Since: 3.0
+ **/
+void
+camel_mempool_destroy (CamelMemPool *pool)
+{
+ if (pool) {
+ camel_mempool_flush (pool, 1);
+ g_slice_free (CamelMemPool, pool);
+ }
+}
diff --git a/camel/camel-mempool.h b/camel/camel-mempool.h
new file mode 100644
index 0000000..5bb3cc0
--- /dev/null
+++ b/camel/camel-mempool.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef CAMEL_MEMPOOL_H
+#define CAMEL_MEMPOOL_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* mempools - allocate variable sized blocks of memory, and free as one */
+/* allocation is very fast, but cannot be freed individually */
+
+/**
+ * CamelMemPool:
+ *
+ * Since: 3.0
+ **/
+typedef struct _CamelMemPool CamelMemPool;
+
+/**
+ * CamelMemPoolFlags:
+ * @CAMEL_MEMPOOL_ALIGN_STRUCT:
+ * Allocate to native structure alignment
+ * @CAMEL_MEMPOOL_ALIGN_WORD:
+ * Allocate to words - 16 bit alignment
+ * @CAMEL_MEMPOOL_ALIGN_BYTE:
+ * Allocate to bytes - 8 bit alignment
+ * @CAMEL_MEMPOOL_ALIGN_MASK:
+ * Which bits determine the alignment information
+ *
+ * Since: 3.0
+ **/
+typedef enum {
+ CAMEL_MEMPOOL_ALIGN_STRUCT,
+ CAMEL_MEMPOOL_ALIGN_WORD,
+ CAMEL_MEMPOOL_ALIGN_BYTE,
+ CAMEL_MEMPOOL_ALIGN_MASK = 0x3
+} CamelMemPoolFlags;
+
+CamelMemPool * camel_mempool_new (gint blocksize,
+ gint threshold,
+ CamelMemPoolFlags flags);
+gpointer camel_mempool_alloc (CamelMemPool *pool,
+ gint size);
+gchar * camel_mempool_strdup (CamelMemPool *pool,
+ const gchar *str);
+void camel_mempool_flush (CamelMemPool *pool,
+ gint freeall);
+void camel_mempool_destroy (CamelMemPool *pool);
+
+G_END_DECLS
+
+#endif /* CAMEL_MEMPOOL_H */
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index 857b955..76569e3 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -35,8 +35,7 @@
#include <glib.h>
-#include <libedataserver/e-memory.h>
-
+#include "camel-mempool.h"
#include "camel-mime-filter.h"
#include "camel-mime-parser.h"
#include "camel-mime-utils.h"
@@ -120,7 +119,7 @@ struct _header_scan_stack {
camel_mime_parser_state_t savestate; /* state at invocation of this part */
#ifdef MEMPOOL
- EMemPool *pool; /* memory pool to keep track of headers/etc at this level */
+ CamelMemPool *pool; /* memory pool to keep track of headers/etc at this level */
#endif
struct _camel_header_raw *headers; /* headers for this part */
@@ -1020,7 +1019,7 @@ folder_pull_part(struct _header_scan_state *s)
s->parts = h->parent;
g_free(h->boundary);
#ifdef MEMPOOL
- e_mempool_destroy(h->pool);
+ camel_mempool_destroy(h->pool);
#else
camel_header_raw_clear(&h->headers);
#endif
@@ -1128,18 +1127,18 @@ header_append_mempool(struct _header_scan_state *s, struct _header_scan_stack *h
content = strchr(header, ':');
if (content) {
register gint len;
- n = e_mempool_alloc(h->pool, sizeof(*n));
+ n = camel_mempool_alloc(h->pool, sizeof(*n));
n->next = NULL;
len = content-header;
- n->name = e_mempool_alloc(h->pool, len+1);
+ n->name = camel_mempool_alloc(h->pool, len+1);
memcpy(n->name, header, len);
n->name[len] = 0;
content++;
len = s->outptr - content;
- n->value = e_mempool_alloc(h->pool, len+1);
+ n->value = camel_mempool_alloc(h->pool, len+1);
memcpy(n->value, content, len);
n->value[len] = 0;
@@ -1199,7 +1198,7 @@ folder_scan_header(struct _header_scan_state *s, gint *lastone)
h = g_malloc0(sizeof(*h));
#ifdef MEMPOOL
- h->pool = e_mempool_new(8192, 4096, E_MEMPOOL_ALIGN_STRUCT);
+ h->pool = camel_mempool_new(8192, 4096, CAMEL_MEMPOOL_ALIGN_STRUCT);
#endif
if (s->parts)
diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c
index 5dce85a..7050fc5 100644
--- a/camel/camel-text-index.c
+++ b/camel/camel-text-index.c
@@ -36,10 +36,9 @@
#include <glib.h>
#include <glib/gstdio.h>
-#include <libedataserver/e-memory.h>
-
#include "camel-block-file.h"
#include "camel-list-utils.h"
+#include "camel-mempool.h"
#include "camel-object.h"
#include "camel-partition-table.h"
#include "camel-private.h"
@@ -69,7 +68,7 @@ typedef struct _CamelTextIndexNamePrivate CamelTextIndexNamePrivate;
struct _CamelTextIndexNamePrivate {
GString *buffer;
camel_key_t nameid;
- EMemPool *pool;
+ CamelMemPool *pool;
};
CamelTextIndexName *camel_text_index_name_new(CamelTextIndex *idx, const gchar *name, camel_key_t nameid);
@@ -1391,7 +1390,7 @@ text_index_name_add_word(CamelIndexName *idn, const gchar *word)
struct _CamelTextIndexNamePrivate *p = ((CamelTextIndexName *)idn)->priv;
if (g_hash_table_lookup(idn->words, word) == NULL) {
- gchar *w = e_mempool_strdup(p->pool, word);
+ gchar *w = camel_mempool_strdup(p->pool, word);
g_hash_table_insert(idn->words, w, w);
}
@@ -1519,7 +1518,7 @@ camel_text_index_name_init(CamelTextIndexName *idn)
p = idn->priv = g_malloc0(sizeof(*idn->priv));
p->buffer = g_string_new("");
- p->pool = e_mempool_new(256, 128, E_MEMPOOL_ALIGN_BYTE);
+ p->pool = camel_mempool_new(256, 128, CAMEL_MEMPOOL_ALIGN_BYTE);
}
static void
@@ -1530,7 +1529,7 @@ camel_text_index_name_finalise(CamelTextIndexName *idn)
g_hash_table_destroy(idn->parent.words);
g_string_free(p->buffer, TRUE);
- e_mempool_destroy(p->pool);
+ camel_mempool_destroy(p->pool);
g_free(p);
}
@@ -1562,7 +1561,7 @@ camel_text_index_name_new(CamelTextIndex *idx, const gchar *name, camel_key_t na
cin->index = (CamelIndex *)idx;
camel_object_ref((CamelObject *)idx);
- cin->name = e_mempool_strdup(p->pool, name);
+ cin->name = camel_mempool_strdup(p->pool, name);
p->nameid = nameid;
return idn;
diff --git a/camel/camel.h b/camel/camel.h
index 776b274..6ef2524 100644
--- a/camel/camel.h
+++ b/camel/camel.h
@@ -58,6 +58,7 @@
#include <camel/camel-lock-client.h>
#include <camel/camel-lock-helper.h>
#include <camel/camel-medium.h>
+#include <camel/camel-mempool.h>
#include <camel/camel-mime-filter.h>
#include <camel/camel-mime-filter-basic.h>
#include <camel/camel-mime-filter-bestenc.h>
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 59d4d37..777f14c 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -14,7 +14,6 @@
#include "camel-imapx-store-summary.h"
#include "camel-imapx-utils.h"
#include "camel-imapx-exception.h"
-#include "libedataserver/e-memory.h"
/* high-level parser state */
#define p(x)
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index 5b172e2..0b3535e 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -36,9 +36,8 @@
#include <glib/gi18n-lib.h>
-#include <libedataserver/e-memory.h>
-
#include "camel-db.h"
+#include "camel-mempool.h"
#include "camel-mime-message.h"
#include "camel-operation.h"
#include "camel-private.h"
@@ -419,7 +418,7 @@ static gint maildir_summary_load(CamelLocalSummary *cls, gint forceindex, CamelE
struct dirent *d;
CamelMaildirSummary *mds = (CamelMaildirSummary *)cls;
gchar *uid;
- EMemPool *pool;
+ CamelMemPool *pool;
gint ret;
cur = g_strdup_printf("%s/cur", cls->folder_path);
@@ -436,7 +435,7 @@ static gint maildir_summary_load(CamelLocalSummary *cls, gint forceindex, CamelE
}
mds->priv->load_map = g_hash_table_new(g_str_hash, g_str_equal);
- pool = e_mempool_new(1024, 512, E_MEMPOOL_ALIGN_BYTE);
+ pool = camel_mempool_new(1024, 512, CAMEL_MEMPOOL_ALIGN_BYTE);
while ((d = readdir(dir))) {
if (d->d_name[0] == '.')
@@ -446,12 +445,12 @@ static gint maildir_summary_load(CamelLocalSummary *cls, gint forceindex, CamelE
uid = strchr(d->d_name, ':');
if (uid) {
gint len = uid-d->d_name;
- uid = e_mempool_alloc(pool, len+1);
+ uid = camel_mempool_alloc(pool, len+1);
memcpy(uid, d->d_name, len);
uid[len] = 0;
- g_hash_table_insert(mds->priv->load_map, uid, e_mempool_strdup(pool, d->d_name));
+ g_hash_table_insert(mds->priv->load_map, uid, camel_mempool_strdup(pool, d->d_name));
} else {
- uid = e_mempool_strdup(pool, d->d_name);
+ uid = camel_mempool_strdup(pool, d->d_name);
g_hash_table_insert(mds->priv->load_map, uid, uid);
}
}
@@ -462,7 +461,7 @@ static gint maildir_summary_load(CamelLocalSummary *cls, gint forceindex, CamelE
g_hash_table_destroy(mds->priv->load_map);
mds->priv->load_map = NULL;
- e_mempool_destroy(pool);
+ camel_mempool_destroy(pool);
return ret;
}
diff --git a/docs/reference/camel/camel-docs.sgml b/docs/reference/camel/camel-docs.sgml
index eb70680..b648679 100644
--- a/docs/reference/camel/camel-docs.sgml
+++ b/docs/reference/camel/camel-docs.sgml
@@ -38,6 +38,7 @@
<!ENTITY CamelLock SYSTEM "xml/camel-lock.xml">
<!ENTITY CamelLockClient SYSTEM "xml/camel-lock-client.xml">
<!ENTITY CamelMedium SYSTEM "xml/camel-medium.xml">
+<!ENTITY CamelMemPool SYSTEM "xml/camel-mempool.xml">
<!ENTITY CamelMIMEFilter SYSTEM "xml/camel-mime-filter.xml">
<!ENTITY CamelMIMEFilterBasic SYSTEM "xml/camel-mime-filter-basic.xml">
<!ENTITY CamelMIMEFilterBestenc SYSTEM "xml/camel-mime-filter-bestenc.xml">
@@ -298,6 +299,7 @@
&CamelListUtils;
&CamelLock;
&CamelLockClient;
+ &CamelMemPool;
&CamelMIMEUtils;
&CamelMovemail;
&CamelMsgPort;
@@ -331,6 +333,10 @@
<title>Index of deprecated symbols</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
+ <index id="api-index-3.0" role="3.0">
+ <title>Index of new symbols in 3.0</title>
+ <xi:include href="xml/api-index-3.0.xml"><xi:fallback /></xi:include>
+ </index>
<index id="api-index-2.30" role="2.30">
<title>Index of new symbols in 2.30</title>
<xi:include href="xml/api-index-2.30.xml"><xi:fallback /></xi:include>
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 898a1a4..07969a2 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -366,9 +366,6 @@ camel_filter_driver_flush
camel_filter_driver_filter_message
camel_filter_driver_filter_mbox
camel_filter_driver_filter_folder
-camel_filter_driver_expand_option
-camel_filter_driver_rule_count
-camel_filter_driver_rule_get
<SUBSECTION Standard>
CAMEL_FILTER_DRIVER
CAMEL_IS_FILTER_DRIVER
@@ -1809,6 +1806,7 @@ CAMEL_STORE_FILTER_INBOX
CAMEL_STORE_VJUNK
CAMEL_STORE_PROXY
CAMEL_STORE_IS_MIGRATING
+CAMEL_STORE_ASYNC
CAMEL_STORE_FOLDER_CREATE
CAMEL_STORE_FOLDER_EXCL
CAMEL_STORE_FOLDER_BODY_INDEX
@@ -3445,6 +3443,17 @@ camel_unlock_folder
</SECTION>
<SECTION>
+<FILE>camel-mempool</FILE>
+CamelMemPool
+CamelMemPoolFlags
+camel_mempool_new
+camel_mempool_alloc
+camel_mempool_strdup
+camel_mempool_flush
+camel_mempool_destroy
+</SECTION>
+
+<SECTION>
<FILE>camel-mime-utils</FILE>
CAMEL_FOLD_SIZE
CAMEL_FOLD_MAX_SIZE
diff --git a/docs/reference/camel/tmpl/camel-mempool.sgml b/docs/reference/camel/tmpl/camel-mempool.sgml
new file mode 100644
index 0000000..7a7a169
--- /dev/null
+++ b/docs/reference/camel/tmpl/camel-mempool.sgml
@@ -0,0 +1,85 @@
+<!-- ##### SECTION Title ##### -->
+camel-mempool
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT CamelMemPool ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ENUM CamelMemPoolFlags ##### -->
+<para>
+
+</para>
+
+ CAMEL_MEMPOOL_ALIGN_STRUCT:
+ CAMEL_MEMPOOL_ALIGN_WORD:
+ CAMEL_MEMPOOL_ALIGN_BYTE:
+ CAMEL_MEMPOOL_ALIGN_MASK:
+
+<!-- ##### FUNCTION camel_mempool_new ##### -->
+<para>
+
+</para>
+
+ blocksize:
+ threshold:
+ flags:
+ Returns:
+
+
+<!-- ##### FUNCTION camel_mempool_alloc ##### -->
+<para>
+
+</para>
+
+ pool:
+ size:
+ Returns:
+
+
+<!-- ##### FUNCTION camel_mempool_strdup ##### -->
+<para>
+
+</para>
+
+ pool:
+ str:
+ Returns:
+
+
+<!-- ##### FUNCTION camel_mempool_flush ##### -->
+<para>
+
+</para>
+
+ pool:
+ freeall:
+
+
+<!-- ##### FUNCTION camel_mempool_destroy ##### -->
+<para>
+
+</para>
+
+ pool:
+
+
diff --git a/docs/reference/camel/tmpl/camel-store.sgml b/docs/reference/camel/tmpl/camel-store.sgml
index 7846821..8fa7c82 100644
--- a/docs/reference/camel/tmpl/camel-store.sgml
+++ b/docs/reference/camel/tmpl/camel-store.sgml
@@ -236,6 +236,13 @@ CamelStore
+<!-- ##### MACRO CAMEL_STORE_ASYNC ##### -->
+<para>
+
+</para>
+
+
+
<!-- ##### MACRO CAMEL_STORE_FOLDER_CREATE ##### -->
<para>
diff --git a/libedataserver/e-memory.h b/libedataserver/e-memory.h
index b2342c4..dcff603 100644
--- a/libedataserver/e-memory.h
+++ b/libedataserver/e-memory.h
@@ -38,6 +38,7 @@ void e_memchunk_empty(EMemChunk *m);
void e_memchunk_clean(EMemChunk *m);
void e_memchunk_destroy(EMemChunk *m);
+#ifndef EDS_DISABLE_DEPRECATED
/* mempools - allocate variable sized blocks of memory, and free as one */
/* allocation is very fast, but cannot be freed individually */
typedef struct _EMemPool EMemPool;
@@ -53,6 +54,7 @@ gpointer e_mempool_alloc(EMemPool *pool, gint size);
gchar *e_mempool_strdup(EMemPool *pool, const gchar *str);
void e_mempool_flush(EMemPool *pool, gint freeall);
void e_mempool_destroy(EMemPool *pool);
+#endif /* EDS_DISABLE_DEPRECATED */
/* strv's string arrays that can be efficiently modified and then compressed mainly for retrival */
/* building is relatively fast, once compressed it takes the minimum amount of memory possible to store */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]