From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 2C5556DE3A2C for ; Sat, 13 Aug 2016 04:39:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: 0.285 X-Spam-Level: X-Spam-Status: No, score=0.285 tagged_above=-999 required=5 tests=[AWL=1.005, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BkUjg_YYcztH for ; Sat, 13 Aug 2016 04:39:28 -0700 (PDT) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id EFDDC6DE3844 for ; Sat, 13 Aug 2016 04:39:12 -0700 (PDT) Received: by mail-wm0-f68.google.com with SMTP id i138so2004294wmf.3 for ; Sat, 13 Aug 2016 04:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=pYUqjKEAM2QcAMxPIpXQWiHvzp0ChQDW96w9W+kxwCw=; b=dGZeQFOYayJMokePpdIDtGBMPpFrNjfpUBPZkCoR0ioUlUiE7bQLG1A6gogyPejYr0 MwnYJEbEW62s+Qu3HXHdQTePyMJVkFQ3BwuXGEfeCu55IZaXURllueMIDO0kNc4j7Rfl gkqESI231aDtIcaecGDzANOrG0Q7lOZmz2XLvW2JMTOXVf1Iv4a0Tsy6YRVcnNoIFDKB RH8y1eBm8cmhkrpO39Q0Z0wkoFBBWw820GTyXWUdf/qpK2vsXKcilO/M7wYLHYOou/Ep +Ekd+OhN7wHheitUiQ47h3aA13k1r1Ld5WYK7ITQ37QlfsRfYviNp8O2KRG09QKHrP6i zcNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=pYUqjKEAM2QcAMxPIpXQWiHvzp0ChQDW96w9W+kxwCw=; b=ZaLDWmcKzjG379hA/diufLwmEOrfDlMHdddJLniM9FZkeb9lPRereZCFStWS0/N+Hv 5DG0MfzRVxl1mbhsiyTPY2yWuaKq/GwHtiiQg4R5j+Gz0wbuL0HiX9FxZU/nCmgboNRb K0BzWLFfR5Qz2guQVn+yJdeAxbBnobywDIp5diwPr7EHhfZboOOcvBRFKhustvZH9fSa zi9F12YEEg6kZ2+7B2H1HkXiJdJXHvD2BIcgCaIyqzf5WwH3sWtrxFe1tSF75w3Pwm2O p/BIDrgjojZNPEQI52ZuQ8GXY+VQLybla/FSOqbSdIKmbz0ZKP3BynjrmRNHw32RNerT DpAw== X-Gm-Message-State: AEkoouuEYw4Gn9Tx2+rUIpje8Gbk6p49fojjZ9Ac7sZ9w9DESxDQ9ZUDdQlVQMVs33YRqw== X-Received: by 10.194.142.78 with SMTP id ru14mr23354803wjb.41.1471088351478; Sat, 13 Aug 2016 04:39:11 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c368-70.dhcp.inet.fi. [88.195.104.70]) by smtp.gmail.com with ESMTPSA id ko7sm11711519wjc.48.2016.08.13.04.39.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Aug 2016 04:39:10 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Cc: Daniel Kahn Gillmor , jani@nikula.org Subject: [PATCH v2 06/14] cli/reply: make references header creation easier to follow Date: Sat, 13 Aug 2016 14:37:30 +0300 Message-Id: <3489bb6606aa6a3fa6d9fc2e9c473c01a7d997eb.1471088022.git.jani@nikula.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2016 11:39:36 -0000 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. --- notmuch-reply.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/notmuch-reply.c b/notmuch-reply.c index eb07405591fd..c2d7402d40ae 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, -- 2.1.4