diff options
author | Elijah Newren <newren@gmail.com> | 2018-02-14 19:51:54 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-14 22:02:52 +0100 |
commit | 84a548dedd6520b73eb8764a8bebd8ede81620c8 (patch) | |
tree | d6a40d701bdb815ea486f190630c57c21ff4ca68 /merge-recursive.c | |
parent | merge-recursive: split out code for determining diff_filepairs (diff) | |
download | git-84a548dedd6520b73eb8764a8bebd8ede81620c8.tar.xz git-84a548dedd6520b73eb8764a8bebd8ede81620c8.zip |
merge-recursive: make a helper function for cleanup for handle_renames
In anticipation of more involved cleanup to come, make a helper function
for doing the cleanup at the end of handle_renames. Rename the already
existing cleanup_rename[s]() to final_cleanup_rename[s](), name the new
helper initial_cleanup_rename(), and leave the big comment in the code
about why we can't do all the cleanup at once.
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index d458096913..76c7a56a2d 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1658,6 +1658,12 @@ struct rename_info { struct string_list *merge_renames; }; +static void initial_cleanup_rename(struct diff_queue_struct *pairs) +{ + free(pairs->queue); + free(pairs); +} + static int handle_renames(struct merge_options *o, struct tree *common, struct tree *head, @@ -1688,16 +1694,13 @@ static int handle_renames(struct merge_options *o, * data structures are still needed and referenced in * process_entry(). But there are a few things we can free now. */ - - free(head_pairs->queue); - free(head_pairs); - free(merge_pairs->queue); - free(merge_pairs); + initial_cleanup_rename(head_pairs); + initial_cleanup_rename(merge_pairs); return clean; } -static void cleanup_rename(struct string_list *rename) +static void final_cleanup_rename(struct string_list *rename) { const struct rename *re; int i; @@ -1713,10 +1716,10 @@ static void cleanup_rename(struct string_list *rename) free(rename); } -static void cleanup_renames(struct rename_info *re_info) +static void final_cleanup_renames(struct rename_info *re_info) { - cleanup_rename(re_info->head_renames); - cleanup_rename(re_info->merge_renames); + final_cleanup_rename(re_info->head_renames); + final_cleanup_rename(re_info->merge_renames); } static struct object_id *stage_oid(const struct object_id *oid, unsigned mode) @@ -2119,7 +2122,7 @@ int merge_trees(struct merge_options *o, } cleanup: - cleanup_renames(&re_info); + final_cleanup_renames(&re_info); string_list_clear(entries, 1); free(entries); |