On 21 May 2018 at 02:25, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Junio C Hamano <gitster@xxxxxxxxx> 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 do not need the .util >> thing string_list gives us (which is one distinct advantage string_list >> has over argv_array, if the application needs that feature). >> >> We would need to make _pushf() and friends return "const char *" if >> we go that route to make the resulting API more useful, though. > > ... and redoing the 4/4 patch using argv_array_pushf() makes the > result look like this, which does not look too bad. Thanks to Jacob, Junio and Peff for comments on the previous iteration. I've taken the six patches that Junio has queued and rebuilt the series to get rid of the new and possibly bug-prone function that no-one uses once the series is over. That is, I've replaced the `string_list_appendf()`-patch with Junio's `argv_push*()`-patch, then squashed Junio's "redoing the 4/4"-patch into patch 4/4 -- with the exception of keeping the `memset(opts->msgs, ...)` which I suspect was mistakenly dropped. Again, thanks for all the helpful comments and patches pointing me in the right direction. Martin Elijah Newren (1): merge-recursive: provide pair of `unpack_trees_{start,finish}()` Junio C Hamano (1): argv-array: return the pushed string from argv_push*() Martin Ågren (2): merge: setup `opts` later in `checkout_fast_forward()` unpack_trees_options: free messages when done argv-array.h | 4 ++-- unpack-trees.h | 8 +++++++- argv-array.c | 6 ++++-- builtin/checkout.c | 1 + merge-recursive.c | 30 ++++++++++++++++-------------- merge.c | 35 ++++++++++++++++++++--------------- unpack-trees.c | 17 ++++++++++++++--- 7 files changed, 64 insertions(+), 37 deletions(-) -- 2.17.0.840.g5d83f92caf