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
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user