git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] revision: replace "struct cmdline_pathspec" with argv_array

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
Sep 21, 2017, 03:57 UTC
Message-ID
<CAN0heSoWnUXSjP1HtRTKpBiOc9JNzZN_+m1O3_Wn+rE43MpPhg@mail.gmail.com>
In-Reply-To
<20170920203659.xqy76bg5nfabvbfx@sigill.intra.peff.net>
On 20 September 2017 at 22:36, Jeff King <peff@peff.net> wrote:
Show 15 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 12 in “revision: fix memory leaks with `struct cmdline_pathspec`”
  1. revision: fix memory leaks with `struct cmdline_pathspec`Martin Ågren, Sep 20, 2017
  2. Jeff KingSep 20, 2017
  3. revision: replace "struct cmdline_pathspec" with argv_arrayJeff King, Sep 20, 2017
  4. Jonathan NiederSep 20, 2017
  5. Jeff KingSep 21, 2017
  6. Jonathan NiederSep 21, 2017
  7. Jeff KingSep 21, 2017
  8. Jonathan NiederSep 21, 2017
  9. Jeff KingSep 21, 2017
  10. Junio C HamanoSep 21, 2017
  11. Martin ÅgrenSep 21, 2017
  12. Junio C HamanoSep 21, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.