aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-exception.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-11-30 11:09:38 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-11-30 11:09:38 +0800
commitd46cb0fd8d142c6dfa186db76202bb9912fbb7fa (patch)
tree09283efea0e5fd246a897b62fa211e96a858d329 /camel/camel-exception.c
parent1af092ec093994115d64ed30f04d11bb322aba35 (diff)
downloadgsoc2013-evolution-d46cb0fd8d142c6dfa186db76202bb9912fbb7fa.tar.gz
gsoc2013-evolution-d46cb0fd8d142c6dfa186db76202bb9912fbb7fa.tar.zst
gsoc2013-evolution-d46cb0fd8d142c6dfa186db76202bb9912fbb7fa.zip
Completely new implementation of NNTP.
2001-11-30 Not Zed <NotZed@Ximian.com> * providers/nntp/camel-nntp-*.c: Completely new implementation of NNTP. Doesn't support subscriptions yet (lists all folders), but should be more reliable (faster?), and has an integrated cache. * camel-exception.c (camel_exception_new): Use e_memchunks for exception blocks. (camel_exception_free): Same. * camel-data-cache.[ch]: New object for managing on-disk caches of anything that can be stored in a camel-stream. * camel-file-utils.c (camel_file_util_mkdir): New function, just a nicer place to put this (than camel-store), should be removed from camel-store. (camel_file_util_safe_filename): New function to url-encode a filename. * camel-mime-parser.c (drop_states): New func to drop the parser state to initial state. (folder_scan_init_with_fd): (folder_scan_init_with_stream): Call above func to reset state if the stream is changed on us so we can change streams to reuse a parser object. svn path=/trunk/; revision=14822
Diffstat (limited to 'camel/camel-exception.c')
-rw-r--r--camel/camel-exception.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
index c5eec66908..1bb6c22550 100644
--- a/camel/camel-exception.c
+++ b/camel/camel-exception.c
@@ -29,6 +29,7 @@
#include <glib.h>
#include "camel-exception.h"
+#include "e-util/e-memory.h"
/* i dont know why gthread_mutex stuff even exists, this is easier */
@@ -46,6 +47,8 @@ static pthread_mutex_t exception_mutex = PTHREAD_MUTEX_INITIALIZER;
#define CAMEL_EXCEPTION_UNLOCK(e)
#endif
+static EMemChunk *exception_chunks = NULL;
+
/**
* camel_exception_new: allocate a new exception object.
*
@@ -59,12 +62,19 @@ camel_exception_new (void)
{
CamelException *ex;
- ex = g_new (CamelException, 1);
+ CAMEL_EXCEPTION_LOCK(exception);
+
+ if (exception_chunks == NULL)
+ exception_chunks = e_memchunk_new(16, sizeof(CamelException));
+
+ ex = e_memchunk_alloc(exception_chunks);
ex->desc = NULL;
/* set the Exception Id to NULL */
ex->id = CAMEL_EXCEPTION_NONE;
+ CAMEL_EXCEPTION_UNLOCK(exception);
+
return ex;
}
@@ -129,7 +139,12 @@ camel_exception_free (CamelException *exception)
if (exception->desc)
g_free (exception->desc);
- g_free (exception);
+
+ CAMEL_EXCEPTION_LOCK(exception);
+
+ e_memchunk_free(exception_chunks, exception);
+
+ CAMEL_EXCEPTION_UNLOCK(exception);
}
/**