[PATCH 1/2] lib: Remove unnecessary checks when calling g_mime_init

Kazuo Teramoto kaz.rag at gmail.com
Fri Dec 30 13:58:09 PST 2011


g_mime_init already check for multiple initializations.
---
 lib/index.cc       |    4 ----
 lib/message-file.c |    4 ----
 2 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/lib/index.cc b/lib/index.cc
index d8f8b2b..6764929 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -419,12 +419,8 @@ _notmuch_message_index_file (notmuch_message_t *message,
     FILE *file = NULL;
     const char *from, *subject;
     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
-    static int initialized = 0;
 
-    if (! initialized) {
 	g_mime_init (0);
-	initialized = 1;
-    }
 
     file = fopen (filename, "r");
     if (! file) {
diff --git a/lib/message-file.c b/lib/message-file.c
index 915aba8..78c7820 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -223,14 +223,10 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,
     char *header, *decoded_value, *header_sofar, *combined_header;
     const char *s, *colon;
     int match, newhdr, hdrsofar, is_received;
-    static int initialized = 0;
 
     is_received = (strcmp(header_desired,"received") == 0);
 
-    if (! initialized) {
 	g_mime_init (0);
-	initialized = 1;
-    }
 
     message->parsing_started = 1;
 
-- 
1.7.8.1



More information about the notmuch mailing list