Thread (1 message) 1 message, 1 author, 2017-09-21

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

From: Junio C Hamano <hidden>
Date: 2017-09-21 04:11:48

Jeff King [off-list ref] writes:
Subject: [PATCH] revision: replace "struct cmdline_pathspec" with argv_array

We assemble an array of strings in a custom struct,
NULL-terminate the result, and then pass it to
parse_pathspec().

But then we never free the array or the individual strings
(nor can we do the latter, as they are heap-allocated when
they come from stdin but not when they come from the
passed-in argv).

Let's swap this out for an argv_array. It does the same
thing with fewer lines of code, and it's safe to call
argv_array_clear() at the end to avoid a memory leak.

Reported-by: Martin Ågren <redacted>
Signed-off-by: Jeff King <redacted>
---
 revision.c | 39 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 28 deletions(-)
Makes sense.  Thanks for cleaning up the mess I made.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help