Re: [PATCH 06/21] convert manual allocations to argv_array

2016-02-20 Thread Eric Sunshine
On Sat, Feb 20, 2016 at 3:57 AM, Jeff King wrote: > On Sat, Feb 20, 2016 at 03:39:36AM -0500, Eric Sunshine wrote: >> I also had made the strbuf_detach() analogy in my response but deleted >> it before sending; I do think it's a reasonable API template to mirror >> via new

Re: [PATCH 06/21] convert manual allocations to argv_array

2016-02-20 Thread Jeff King
On Sat, Feb 20, 2016 at 03:39:36AM -0500, Eric Sunshine wrote: > I also had made the strbuf_detach() analogy in my response but deleted > it before sending; I do think it's a reasonable API template to mirror > via new argv_array_detach(). That would look like this, which I think is not too bad

Re: [PATCH 06/21] convert manual allocations to argv_array

2016-02-20 Thread Eric Sunshine
On Sat, Feb 20, 2016 at 3:34 AM, Jeff King wrote: > On Sat, Feb 20, 2016 at 03:29:29AM -0500, Eric Sunshine wrote: >> On Sat, Feb 20, 2016 at 3:10 AM, Jeff King wrote: >> > On Sat, Feb 20, 2016 at 03:07:00AM -0500, Eric Sunshine wrote: >> >> > + /*

Re: [PATCH 06/21] convert manual allocations to argv_array

2016-02-20 Thread Jeff King
On Sat, Feb 20, 2016 at 03:29:29AM -0500, Eric Sunshine wrote: > On Sat, Feb 20, 2016 at 3:10 AM, Jeff King wrote: > > On Sat, Feb 20, 2016 at 03:07:00AM -0500, Eric Sunshine wrote: > >> > + /* argv strings are now owned by pathspec */ > >> > +

Re: [PATCH 06/21] convert manual allocations to argv_array

2016-02-20 Thread Eric Sunshine
On Sat, Feb 20, 2016 at 3:10 AM, Jeff King wrote: > On Sat, Feb 20, 2016 at 03:07:00AM -0500, Eric Sunshine wrote: >> > + /* argv strings are now owned by pathspec */ >> > + paths.argc = 0; >> > + argv_array_clear(); >> >> This overly

Re: [PATCH 06/21] convert manual allocations to argv_array

2016-02-20 Thread Jeff King
On Sat, Feb 20, 2016 at 03:07:00AM -0500, Eric Sunshine wrote: > > diff --git a/line-log.c b/line-log.c > > @@ -746,23 +747,16 @@ void line_log_init(struct rev_info *rev, const char > > *prefix, struct string_list > > if (!rev->diffopt.detect_rename) { > > - int i, count =

Re: [PATCH 06/21] convert manual allocations to argv_array

2016-02-20 Thread Eric Sunshine
On Fri, Feb 19, 2016 at 6:23 AM, Jeff King wrote: > There are many manual argv allocations that predate the > argv_array API. Switching to that API brings a few > advantages: > > 1. We no longer have to manually compute the correct final > array size (so it's one less thing

[PATCH 06/21] convert manual allocations to argv_array

2016-02-19 Thread Jeff King
There are many manual argv allocations that predate the argv_array API. Switching to that API brings a few advantages: 1. We no longer have to manually compute the correct final array size (so it's one less thing we can screw up). 2. In many cases we had to make a separate pass to