[PATCH 12/16] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 1 22:16:49 PDT 2019


Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
 lib/message-file.c |  4 ++--
 lib/thread.cc      |  2 +-
 mime-node.c        |  2 +-
 notmuch-reply.c    | 10 +++++-----
 notmuch-search.c   |  4 ++--
 notmuch-show.c     |  4 ++--
 util/gmime-extra.h |  7 -------
 7 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index 214f3c1d..c507ee34 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -212,7 +212,7 @@ static char *
 _extend_header (char *combined, const char *value) {
     char *decoded;
 
-    decoded = g_mime_utils_header_decode_text (value);
+    decoded = g_mime_utils_header_decode_text (NULL, value);
     if (! decoded) {
 	if (combined) {
 	    g_free (combined);
@@ -296,7 +296,7 @@ _notmuch_message_file_get_header (notmuch_message_file_t *message,
 	value = g_mime_object_get_header (GMIME_OBJECT (message->message),
 					  header);
 	if (value)
-	    decoded = g_mime_utils_header_decode_text (value);
+	    decoded = g_mime_utils_header_decode_text (NULL, value);
 	else
 	    decoded = g_strdup ("");
     }
diff --git a/lib/thread.cc b/lib/thread.cc
index 47c90664..c9c9398f 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -284,7 +284,7 @@ _thread_add_message (notmuch_thread_t *thread,
 
     from = notmuch_message_get_header (message, "from");
     if (from)
-	list = internet_address_list_parse_string (from);
+	list = internet_address_list_parse (NULL, from);
 
     if (list) {
 	address = internet_address_list_get_address (list, 0);
diff --git a/mime-node.c b/mime-node.c
index ffd116ef..4b9734f3 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -176,7 +176,7 @@ node_verify (mime_node_t *node, GMimeObject *part)
 
     node->verify_attempted = true;
     node->sig_list = g_mime_multipart_signed_verify
-	(GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
+	(GMIME_MULTIPART_SIGNED (part), GMIME_ENCRYPT_NONE, &err);
 
     if (node->sig_list)
 	set_signature_list_destructor (node);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index a8bb3929..5faae494 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -28,7 +28,7 @@ static void
 show_reply_headers (GMimeStream *stream, GMimeMessage *message)
 {
     /* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
-    if (g_mime_object_write_to_stream (GMIME_OBJECT(message), stream) < 0) {
+    if (g_mime_object_write_to_stream (GMIME_OBJECT(message), NULL, stream) < 0) {
 	INTERNAL_ERROR("failed to write headers to stdout\n");
     }
 }
@@ -547,7 +547,7 @@ create_reply_message(void *ctx,
     in_reply_to = talloc_asprintf (ctx, "<%s>",
 				   notmuch_message_get_message_id (message));
 
-    g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to);
+    g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to, NULL);
 
     orig_references = notmuch_message_get_header (message, "references");
     if (orig_references && *orig_references)
@@ -556,7 +556,7 @@ create_reply_message(void *ctx,
     else
 	references = talloc_strdup (ctx, in_reply_to);
 
-    g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
+    g_mime_object_set_header (GMIME_OBJECT (reply), "References", references, NULL);
 
     from_addr = add_recipients_from_message (reply, config,
 					     mime_message, reply_all);
@@ -595,13 +595,13 @@ create_reply_message(void *ctx,
     from_addr = talloc_asprintf (ctx, "%s <%s>",
 				 notmuch_config_get_user_name (config),
 				 from_addr);
-    g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr);
+    g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr, NULL);
 
     subject = notmuch_message_get_header (message, "subject");
     if (subject) {
 	if (strncasecmp (subject, "Re:", 3))
 	    subject = talloc_asprintf (ctx, "Re: %s", subject);
-	g_mime_message_set_subject (reply, subject);
+	g_mime_message_set_subject (reply, subject, NULL);
     }
 
     return reply;
diff --git a/notmuch-search.c b/notmuch-search.c
index 8f467db4..e2dee418 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -364,7 +364,7 @@ print_mailbox (const search_context_t *ctx, const mailbox_t *mailbox)
 
     /* name_addr has the name part quoted if necessary. Compare
      * 'John Doe <john at doe.com>' vs. '"Doe, John" <john at doe.com>' */
-    name_addr = internet_address_to_string (ia, false);
+    name_addr = internet_address_to_string (ia, NULL, false);
 
     if (format->is_text_printer) {
 	if (ctx->output & OUTPUT_COUNT) {
@@ -446,7 +446,7 @@ process_address_header (const search_context_t *ctx, const char *value)
     if (value == NULL)
 	return;
 
-    list = internet_address_list_parse_string (value);
+    list = internet_address_list_parse (NULL, value);
     if (list == NULL)
 	return;
 
diff --git a/notmuch-show.c b/notmuch-show.c
index 90f6d815..ca4329f1 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -146,7 +146,7 @@ _extract_email_address (const void *ctx, const char *from)
     InternetAddressMailbox *mailbox;
     const char *email = "MAILER-DAEMON";
 
-    addresses = internet_address_list_parse_string (from);
+    addresses = internet_address_list_parse (NULL, from);
 
     /* Bail if there is no address here. */
     if (addresses == NULL || internet_address_list_length (addresses) < 1)
@@ -862,7 +862,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
 	 * encapsulating part's headers).  For multipart parts,
 	 * this will include the headers. */
 	if (stream_filter)
-	    g_mime_object_write_to_stream (node->part, stream_filter);
+	    g_mime_object_write_to_stream (node->part, NULL, stream_filter);
     }
 
     if (stream_filter)
diff --git a/util/gmime-extra.h b/util/gmime-extra.h
index e6ba45b6..d2636b78 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,14 +9,7 @@ extern "C" {
 
 GMimeStream *g_mime_stream_stdout_new(void);
 
-#define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
-#define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
-#define g_mime_object_write_to_stream(o,s) g_mime_object_write_to_stream (o,NULL,s)
-#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
 #define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
-#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
-#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
-#define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str)
 
 /**
  * Get last 16 hex digits of fingerprint ("keyid")
-- 
2.20.1



More information about the notmuch mailing list