Call camel_mime_utils_shutdown() and camel_operation_shutdown().
authorJeffrey Stedfast <fejj@novell.com>
Fri, 18 Jun 2004 20:07:09 +0000 (20:07 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Fri, 18 Jun 2004 20:07:09 +0000 (20:07 +0000)
2004-06-18  Jeffrey Stedfast  <fejj@novell.com>

* 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
camel/camel-mime-utils.c
camel/camel-mime-utils.h
camel/camel-operation.c
camel/camel.c

index d2ceff2..0b1745b 100644 (file)
@@ -1,5 +1,13 @@
 2004-06-18  Jeffrey Stedfast  <fejj@novell.com>
 
+       * 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!
 
index 4e5ec39..6e7607f 100644 (file)
@@ -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);
+}
index 5fb23be..23987a5 100644 (file)
@@ -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);
index 8718c52..7c64125 100644 (file)
@@ -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.
index 09ba07c..f370d89 100644 (file)
@@ -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;
 }