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.
This commit is contained in:
Jani Nikula 2016-09-13 20:14:14 +03:00 committed by David Bremner
parent b1aca0e502
commit 1e289ed1c9

View file

@ -538,13 +538,12 @@ create_reply_message(void *ctx,
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);
orig_references = notmuch_message_get_header (message, "references"); orig_references = notmuch_message_get_header (message, "references");
if (!orig_references) if (orig_references && *orig_references)
/* Treat errors like missing References headers. */ references = talloc_asprintf (ctx, "%s %s", orig_references,
orig_references = "";
references = talloc_asprintf (ctx, "%s%s%s",
*orig_references ? orig_references : "",
*orig_references ? " " : "",
in_reply_to); in_reply_to);
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);
from_addr = add_recipients_from_message (reply, config, from_addr = add_recipients_from_message (reply, config,