[PATCH 1/2] lib: Remove unnecessary checks when calling g_mime_init
Austin Clements
amdragon at MIT.EDU
Fri Dec 30 20:45:50 PST 2011
Shouldn't we remove the g_mime_init's from this code entirely if we're
going to do it in notmuch_database_open?
Quoth Kazuo Teramoto on Dec 30 at 7:58 pm:
> 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;
>
More information about the notmuch
mailing list