From: "Martin Ågren" <martin.agren@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] revision: replace "struct cmdline_pathspec" with argv_array
Date: Thu, 21 Sep 2017 05:57:39 +0200 [thread overview]
Message-ID: <CAN0heSoWnUXSjP1HtRTKpBiOc9JNzZN_+m1O3_Wn+rE43MpPhg@mail.gmail.com> (raw)
In-Reply-To: <20170920203659.xqy76bg5nfabvbfx@sigill.intra.peff.net>
On 20 September 2017 at 22:36, Jeff King <peff@peff.net> wrote:
> On Wed, Sep 20, 2017 at 04:25:52PM -0400, Jeff King wrote:
>
>> Isn't this whole thing just an argv_array, and this is argv_array_pushv?
>> We even NULL-terminate it manually later on!
>>
>> So rather than increasing the line count by adding
>> free_cmdline_pathspec, I think we could actually _reduce_ it by
>> converting to an argv array, as below. And then adding in your free
>> would be one extra line.
>
> Here it is with a commit message, and that final free added.
>
> Sorry for stealing your patch, but I didn't want to suggest "couldn't
> you replace this with argv_array" without actually seeing if it was
> possible. At which point the patch was pretty much done.
No need to be sorry. I wasn't aware of the argv_array thing, thanks for
seeing the bigger picture. I haven't looked into the details, or your
and Jonathan's discussion, but just from a cursory look this looks way
better. It reuses existing infrastructure, and then this:
> revision.c | 39 +++++++++++----------------------------
> 1 file changed, 11 insertions(+), 28 deletions(-)
Martin
next prev parent reply other threads:[~2017-09-21 3:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 19:47 [PATCH] revision: fix memory leaks with `struct cmdline_pathspec` Martin Ågren
2017-09-20 20:25 ` Jeff King
2017-09-20 20:36 ` [PATCH] revision: replace "struct cmdline_pathspec" with argv_array Jeff King
2017-09-20 22:48 ` Jonathan Nieder
2017-09-21 3:04 ` Jeff King
2017-09-21 3:49 ` Jonathan Nieder
2017-09-21 4:48 ` Jeff King
2017-09-21 4:41 ` Jonathan Nieder
2017-09-21 4:50 ` Jeff King
2017-09-21 5:10 ` Junio C Hamano
2017-09-21 3:57 ` Martin Ågren [this message]
2017-09-21 4:11 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN0heSoWnUXSjP1HtRTKpBiOc9JNzZN_+m1O3_Wn+rE43MpPhg@mail.gmail.com \
--to=martin.agren@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).