string-list.h users: change to use *_{nodup,dup}()

Change all in-tree users of the string_list_init(LIST, BOOL) API to use string_list_init_{nodup,dup}(LIST) instead. As noted in the preceding commit let's leave the now-unused string_list_init() wrapper in-place for any in-flight users, it can be removed at some later date. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jul 1, 2021 at 12:51 UTC bc40dfb10a06612813a3f9b733d65af0732208b2
8 files changed +13 -13
apply.c
+3 -3
@@ -101,9 +101,9 @@ int init_apply_state(struct apply_state *state,
101 state->ws_error_action = warn_on_ws_error;
102 state->ws_ignore_action = ignore_ws_none;
103 state->linenr = 1;
104 - string_list_init(&state->fn_table, 0);
105 - string_list_init(&state->limit_by_name, 0);
106 - string_list_init(&state->symlink_changes, 0);
104 + string_list_init_nodup(&state->fn_table);
105 + string_list_init_nodup(&state->limit_by_name);
106 + string_list_init_nodup(&state->symlink_changes);
107 strbuf_init(&state->root, 0);
108
109 git_apply_config();
archive.c
+1 -1
@@ -645,7 +645,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
645 args.pretty_ctx = &ctx;
646 args.repo = repo;
647 args.prefix = prefix;
648 - string_list_init(&args.extra_files, 1);
648 + string_list_init_dup(&args.extra_files);
649 argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote);
650 if (!startup_info->have_repository) {
651 /*
config.c
+1 -1
@@ -2072,7 +2072,7 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
2072 e = xmalloc(sizeof(*e));
2073 hashmap_entry_init(&e->ent, strhash(key));
2074 e->key = xstrdup(key);
2075 - string_list_init(&e->value_list, 1);
2075 + string_list_init_dup(&e->value_list);
2076 hashmap_add(&cs->config_hash, &e->ent);
2077 }
2078 si = string_list_append_nodup(&e->value_list, xstrdup_or_null(value));
entry.c
+2 -2
@@ -143,8 +143,8 @@ void enable_delayed_checkout(struct checkout *state)
143 if (!state->delayed_checkout) {
144 state->delayed_checkout = xmalloc(sizeof(*state->delayed_checkout));
145 state->delayed_checkout->state = CE_CAN_DELAY;
146 - string_list_init(&state->delayed_checkout->filters, 0);
147 - string_list_init(&state->delayed_checkout->paths, 0);
146 + string_list_init_nodup(&state->delayed_checkout->filters);
147 + string_list_init_nodup(&state->delayed_checkout->paths);
148 }
149 }
150
merge-ort.c
+2 -2
@@ -1729,7 +1729,7 @@ static void compute_collisions(struct strmap *collisions,
1729 free(new_path);
1730 } else {
1731 CALLOC_ARRAY(collision_info, 1);
1732 - string_list_init(&collision_info->source_files, 0);
1732 + string_list_init_nodup(&collision_info->source_files);
1733 strmap_put(collisions, new_path, collision_info);
1734 }
1735 string_list_insert(&collision_info->source_files,
@@ -3689,7 +3689,7 @@ static void merge_start(struct merge_options *opt, struct merge_result *result)
3689 */
3690 strmap_init_with_options(&opt->priv->paths, NULL, 0);
3691 strmap_init_with_options(&opt->priv->conflicted, NULL, 0);
3692 - string_list_init(&opt->priv->paths_to_free, 0);
3692 + string_list_init_nodup(&opt->priv->paths_to_free);
3693
3694 /*
3695 * keys & strbufs in output will sometimes need to outlive "paths",
merge-recursive.c
+2 -2
@@ -121,7 +121,7 @@ static void dir_rename_entry_init(struct dir_rename_entry *entry,
121 entry->dir = directory;
122 entry->non_unique_new_dir = 0;
123 strbuf_init(&entry->new_dir, 0);
124 - string_list_init(&entry->possible_new_dirs, 0);
124 + string_list_init_nodup(&entry->possible_new_dirs);
125 }
126
127 struct collision_entry {
@@ -3703,7 +3703,7 @@ static int merge_start(struct merge_options *opt, struct tree *head)
3703 }
3704
3705 CALLOC_ARRAY(opt->priv, 1);
3706 - string_list_init(&opt->priv->df_conflict_file_set, 1);
3706 + string_list_init_dup(&opt->priv->df_conflict_file_set);
3707 return 0;
3708 }
3709
refs/packed-backend.c
+1 -1
@@ -1425,7 +1425,7 @@ static int packed_transaction_prepare(struct ref_store *ref_store,
1425 */
1426
1427 CALLOC_ARRAY(data, 1);
1428 - string_list_init(&data->updates, 0);
1428 + string_list_init_nodup(&data->updates);
1429
1430 transaction->backend_data = data;
1431
transport.c
+1 -1
@@ -1050,7 +1050,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
1050 struct transport *ret = xcalloc(1, sizeof(*ret));
1051
1052 ret->progress = isatty(2);
1053 - string_list_init(&ret->pack_lockfiles, 1);
1053 + string_list_init_dup(&ret->pack_lockfiles);
1054
1055 if (!remote)
1056 BUG("No remote provided to transport_get()");