merge-ort: rename str{map,intmap,set}_func()

In order to make it clearer that these three variables holding a function refer to functions that will clear the strmap/strintmap/strset, rename them to str{map,intmap,set}_clear_func(). Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jul 30, 2021 at 11:47 UTC 7afc0b03a2307aa02b7caff2746664e886f38d9a
1 file changed +13 -13
merge-ort.c
+13 -13
@@ -519,11 +519,11 @@ static void clear_or_reinit_internal_opts(struct merge_options_internal *opti,
519 {
520 struct rename_info *renames = &opti->renames;
521 int i;
522 - void (*strmap_func)(struct strmap *, int) =
522 + void (*strmap_clear_func)(struct strmap *, int) =
523 reinitialize ? strmap_partial_clear : strmap_clear;
524 - void (*strintmap_func)(struct strintmap *) =
524 + void (*strintmap_clear_func)(struct strintmap *) =
525 reinitialize ? strintmap_partial_clear : strintmap_clear;
526 - void (*strset_func)(struct strset *) =
526 + void (*strset_clear_func)(struct strset *) =
527 reinitialize ? strset_partial_clear : strset_clear;
528
529 /*
@@ -534,14 +534,14 @@ static void clear_or_reinit_internal_opts(struct merge_options_internal *opti,
534 * to deallocate them.
535 */
536 free_strmap_strings(&opti->paths);
537 - strmap_func(&opti->paths, 1);
537 + strmap_clear_func(&opti->paths, 1);
538
539 /*
540 * All keys and values in opti->conflicted are a subset of those in
541 * opti->paths. We don't want to deallocate anything twice, so we
542 * don't free the keys and we pass 0 for free_values.
543 */
544 - strmap_func(&opti->conflicted, 0);
544 + strmap_clear_func(&opti->conflicted, 0);
545
546 /*
547 * opti->paths_to_free is similar to opti->paths; we created it with
@@ -559,24 +559,24 @@ static void clear_or_reinit_internal_opts(struct merge_options_internal *opti,
559
560 /* Free memory used by various renames maps */
561 for (i = MERGE_SIDE1; i <= MERGE_SIDE2; ++i) {
562 - strintmap_func(&renames->dirs_removed[i]);
563 - strmap_func(&renames->dir_renames[i], 0);
564 - strintmap_func(&renames->relevant_sources[i]);
562 + strintmap_clear_func(&renames->dirs_removed[i]);
563 + strmap_clear_func(&renames->dir_renames[i], 0);
564 + strintmap_clear_func(&renames->relevant_sources[i]);
565 if (!reinitialize)
566 assert(renames->cached_pairs_valid_side == 0);
567 if (i != renames->cached_pairs_valid_side &&
568 -1 != renames->cached_pairs_valid_side) {
569 - strset_func(&renames->cached_target_names[i]);
570 - strmap_func(&renames->cached_pairs[i], 1);
571 - strset_func(&renames->cached_irrelevant[i]);
569 + strset_clear_func(&renames->cached_target_names[i]);
570 + strmap_clear_func(&renames->cached_pairs[i], 1);
571 + strset_clear_func(&renames->cached_irrelevant[i]);
572 partial_clear_dir_rename_count(&renames->dir_rename_count[i]);
573 if (!reinitialize)
574 strmap_clear(&renames->dir_rename_count[i], 1);
575 }
576 }
577 for (i = MERGE_SIDE1; i <= MERGE_SIDE2; ++i) {
578 - strintmap_func(&renames->deferred[i].possible_trivial_merges);
579 - strset_func(&renames->deferred[i].target_dirs);
578 + strintmap_clear_func(&renames->deferred[i].possible_trivial_merges);
579 + strset_clear_func(&renames->deferred[i].target_dirs);
580 renames->deferred[i].trivial_merges_okay = 1; /* 1 == maybe */
581 }
582 renames->cached_pairs_valid_side = 0;