From d46cb0fd8d142c6dfa186db76202bb9912fbb7fa Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 30 Nov 2001 03:09:38 +0000 Subject: Completely new implementation of NNTP. 2001-11-30 Not Zed * 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 --- camel/camel-exception.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'camel/camel-exception.c') 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 #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); } /** -- cgit v1.2.3