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 EA7D86DE0C51 for ; Sat, 10 Sep 2016 09:23:45 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.007 X-Spam-Level: X-Spam-Status: No, score=-0.007 tagged_above=-999 required=5 tests=[AWL=0.004, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-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 vDKH_CCg4LJ8 for ; Sat, 10 Sep 2016 09:23:45 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 507DB6DE0C44 for ; Sat, 10 Sep 2016 09:23:45 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1bil44-0004MW-Tj; Sat, 10 Sep 2016 12:23:36 -0400 Received: (nullmailer pid 14183 invoked by uid 1000); Sat, 10 Sep 2016 16:23:42 -0000 From: David Bremner To: Jani Nikula , notmuch@notmuchmail.org Cc: Daniel Kahn Gillmor Subject: Re: [PATCH v2 06/14] cli/reply: make references header creation easier to follow In-Reply-To: <3489bb6606aa6a3fa6d9fc2e9c473c01a7d997eb.1471088022.git.jani@nikula.org> References: <3489bb6606aa6a3fa6d9fc2e9c473c01a7d997eb.1471088022.git.jani@nikula.org> User-Agent: Notmuch/0.22.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Sat, 10 Sep 2016 13:23:42 -0300 Message-ID: <874m5n206p.fsf@zancas.localnet> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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, 10 Sep 2016 16:23:46 -0000 Jani Nikula writes: > 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); > + fine, and probably applicable earlier if the series stalls. d