aboutsummaryrefslogtreecommitdiff
path: root/notmuch-reply.c
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2016-09-13 20:14:14 +0300
committerDavid Bremner <david@tethera.net>2016-09-17 09:00:31 -0300
commit1e289ed1c9fb8af8696c2735b714438bd115725f (patch)
tree7fdc886c120df5f2207dfd6486d02ab3e2ebac3f /notmuch-reply.c
parentb1aca0e502e97ab822da60aa4217d4b0bdb33543 (diff)
cli/reply: make references header creation easier to follow
Just use strdup when original references is not available, instead of trying to cram everything into a monster asprintf. There should be no functional changes.
Diffstat (limited to 'notmuch-reply.c')
-rw-r--r--notmuch-reply.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/notmuch-reply.c b/notmuch-reply.c
index eb074055..c2d7402d 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -538,13 +538,12 @@ create_reply_message(void *ctx,
g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to);
orig_references = notmuch_message_get_header (message, "references");
- if (!orig_references)
- /* Treat errors like missing References headers. */
- orig_references = "";
- references = talloc_asprintf (ctx, "%s%s%s",
- *orig_references ? orig_references : "",
- *orig_references ? " " : "",
- in_reply_to);
+ if (orig_references && *orig_references)
+ references = talloc_asprintf (ctx, "%s %s", orig_references,
+ in_reply_to);
+ else
+ references = talloc_strdup (ctx, in_reply_to);
+
g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
from_addr = add_recipients_from_message (reply, config,