Re: Re*: [PATCH v4 3/4] string-list: provide `string_list_appendf()`

2018-05-20 Thread Jeff King
On Mon, May 21, 2018 at 09:25:01AM +0900, Junio C Hamano wrote: > Junio C Hamano writes: > > > I have a feeling that argv_array might be a better fit for the > > purpose of keeping track of to_free[] strings in the context of this > > series. Moving away from string_list

Re: Re*: [PATCH v4 3/4] string-list: provide `string_list_appendf()`

2018-05-20 Thread Jeff King
On Mon, May 21, 2018 at 09:01:05AM +0900, Junio C Hamano wrote: > Jacob Keller writes: > > > On Sun, May 20, 2018 at 3:17 AM, Martin Ågren > > wrote: > >> +/** > >> + * Add formatted string to the end of `list`. This function ignores > >> + *

Re: Re*: [PATCH v4 3/4] string-list: provide `string_list_appendf()`

2018-05-20 Thread Junio C Hamano
Junio C Hamano writes: > I have a feeling that argv_array might be a better fit for the > purpose of keeping track of to_free[] strings in the context of this > series. Moving away from string_list would allow us to sidestep the > storage ownership issues the API has, and we

Re*: [PATCH v4 3/4] string-list: provide `string_list_appendf()`

2018-05-20 Thread Junio C Hamano
Jacob Keller writes: > On Sun, May 20, 2018 at 3:17 AM, Martin Ågren wrote: >> +/** >> + * Add formatted string to the end of `list`. This function ignores >> + * the value of `list->strdup_strings` and always appends a freshly >> + * allocated

Re: [PATCH v4 3/4] string-list: provide `string_list_appendf()`

2018-05-20 Thread Jacob Keller
On Sun, May 20, 2018 at 3:17 AM, Martin Ågren wrote: > +/** > + * Add formatted string to the end of `list`. This function ignores > + * the value of `list->strdup_strings` and always appends a freshly > + * allocated string, so you will probably not want to use it with >

[PATCH v4 3/4] string-list: provide `string_list_appendf()`

2018-05-20 Thread Martin Ågren
Add a function `string_list_appendf(list, fmt, ...)` to the string-list API. The next commit will add a user. This function naturally ignores the `strdup_strings`-setting and always appends a freshly allocated string. Thus, using this function with `strdup_strings = 0` risks making ownership