[PATCH v4 0/4] unpack_trees_options: free messages when done
From: Martin Ågren <hidden>
Date: 2018-05-20 10:18:23
This is v4 of my series for taking care of the memory allocated by `setup_unpack_trees_porcelain()`. As before, this is based on bp/merge-rename-config. On 19 May 2018 at 08:13, Martin Ågren [off-list ref] wrote:
On 19 May 2018 at 03:02, Jeff King [off-list ref] wrote:quoted
quoted
quoted
would become: msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOUPTODATE_FILE] = string_list_appendf(&opts->msgs_to_free, msg, cmd, cmd)->string; I don't know if that's worth it or not (I suspect that there are other places where appendf would be handy, but I didn't poke around).I'll look into this over the weekend. Thanks for the suggestion.
The difference to v3 is indeed the new patch 3/4, which introduces
`string_list_appendf()`. I think that makes patch 4/4 clearer and the
resulting code less surprising.
There is an obvious candidate for using this new function in bisect.c,
but I refrained from doing that conversion in this series. While
converting that user to use this new function would be trivial and safe,
such a change might not look entirely sane on its own. The reason is
that the user does the whole `strdup_strings`-dance that I did in v3.
I think it would be much better to do that conversion as a part of a
"let's not play with strdup_strings"-patch. I have one prepared and it
looks quite ok to me. I should be able to be able to collect more
`strdup_string`-cleanups soonish and submit a series later (say, when/if
this here series has matured).
Elijah Newren (1):
merge-recursive: provide pair of `unpack_trees_{start,finish}()`
Martin Ågren (3):
merge: setup `opts` later in `checkout_fast_forward()`
string-list: provide `string_list_appendf()`
unpack_trees_options: free messages when done
string-list.h | 9 +++++++++
unpack-trees.h | 6 ++++++
builtin/checkout.c | 1 +
merge-recursive.c | 30 ++++++++++++++++--------------
merge.c | 35 ++++++++++++++++++++---------------
string-list.c | 13 +++++++++++++
unpack-trees.c | 20 +++++++++++++++++---
7 files changed, 82 insertions(+), 32 deletions(-)
--
2.17.0.840.g5d83f92caf