From e3472de63aabd24df698fa9b828dcd3eb1a7b27a Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 18 Jun 2004 20:07:09 +0000 Subject: [PATCH] Call camel_mime_utils_shutdown() and camel_operation_shutdown(). 2004-06-18 Jeffrey Stedfast * camel.c (camel_shutdown): Call camel_mime_utils_shutdown() and camel_operation_shutdown(). * camel-operation.c (camel_operation_shutdown): New function. * camel-mime-utils.c (camel_mime_utils_shutdown): New function to clean up the compiled regexes. --- camel/ChangeLog | 8 ++++++++ camel/camel-mime-utils.c | 12 +++++++++++- camel/camel-mime-utils.h | 1 + camel/camel-operation.c | 11 +++++++++++ camel/camel.c | 4 ++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index d2ceff2..0b1745b 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,13 @@ 2004-06-18 Jeffrey Stedfast + * camel.c (camel_shutdown): Call camel_mime_utils_shutdown() and + camel_operation_shutdown(). + + * camel-operation.c (camel_operation_shutdown): New function. + + * camel-mime-utils.c (camel_mime_utils_shutdown): New function to + clean up the compiled regexes. + * camel-stream-buffer.c (set_vbuf): Need to re-init sbf->ptr and sbf->end too, or we'll be sorrryy! diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 4e5ec39..6e7607f 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -4246,7 +4246,7 @@ camel_mime_utils_init(void) base64_init(); /* precompile regex's for speed at runtime */ - for (i = 0; i < sizeof(mail_list_magic) / sizeof(mail_list_magic[0]); i++) { + for (i = 0; i < G_N_ELEMENTS (mail_list_magic); i++) { errcode = regcomp(&mail_list_magic[i].regex, mail_list_magic[i].pattern, REG_EXTENDED|REG_ICASE); if (errcode != 0) { char *errstr; @@ -4264,3 +4264,13 @@ camel_mime_utils_init(void) g_assert(regex_compilation_failed == 0); } + + +void +camel_mime_utils_shutdown (void) +{ + int i; + + for (i = 0; i < G_N_ELEMENTS (mail_list_magic); i++) + regfree (&mail_list_magic[i].regex); +} diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h index 5fb23be..23987a5 100644 --- a/camel/camel-mime-utils.h +++ b/camel/camel-mime-utils.h @@ -114,6 +114,7 @@ struct _camel_header_newsgroup { /* MUST be called before everything else */ void camel_mime_utils_init(void); +void camel_mime_utils_shutdown (void); /* Address lists */ struct _camel_header_address *camel_header_address_new (void); diff --git a/camel/camel-operation.c b/camel/camel-operation.c index 8718c52..7c64125 100644 --- a/camel/camel-operation.c +++ b/camel/camel-operation.c @@ -105,6 +105,17 @@ camel_operation_init(void) } /** + * camel_operation_shutdown: + * + * Cleans up internal variables. + **/ +void +camel_operation_shutdown (void) +{ + pthread_key_delete (&operation_key); +} + +/** * camel_operation_new: * @status: Callback for receiving status messages. This will always * be called with an internal lock held. diff --git a/camel/camel.c b/camel/camel.c index 09ba07c..f370d89 100644 --- a/camel/camel.c +++ b/camel/camel.c @@ -46,6 +46,7 @@ static int initialised = FALSE; static void camel_shutdown (void) { + void camel_operation_shutdown (void); CamelCertDB *certdb; if (!initialised) @@ -63,6 +64,9 @@ camel_shutdown (void) camel_object_unref (certdb); } + camel_operation_shutdown (); + camel_mime_utils_shutdown (); + initialised = FALSE; } -- 2.7.4