Skip to content

Commit 6b5005c

Browse files
committed
Merge branch 'tf/string-list-init'
* tf/string-list-init: string_list: Add STRING_LIST_INIT macro and make use of it.
2 parents 165dc78 + 183113a commit 6b5005c

16 files changed

+36
-31
lines changed

builtin/fast-export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
566566
{
567567
struct rev_info revs;
568568
struct object_array commits = { 0, 0, NULL };
569-
struct string_list extra_refs = { NULL, 0, 0, 0 };
569+
struct string_list extra_refs = STRING_LIST_INIT_NODUP;
570570
struct commit *commit;
571571
char *export_filename = NULL, *import_filename = NULL;
572572
struct option options[] = {

builtin/fetch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ static void find_non_local_tags(struct transport *transport,
548548
struct ref **head,
549549
struct ref ***tail)
550550
{
551-
struct string_list existing_refs = { NULL, 0, 0, 0 };
552-
struct string_list remote_refs = { NULL, 0, 0, 0 };
551+
struct string_list existing_refs = STRING_LIST_INIT_NODUP;
552+
struct string_list remote_refs = STRING_LIST_INIT_NODUP;
553553
const struct ref *ref;
554554
struct string_list_item *item = NULL;
555555

@@ -651,7 +651,7 @@ static int truncate_fetch_head(void)
651651
static int do_fetch(struct transport *transport,
652652
struct refspec *refs, int ref_count)
653653
{
654-
struct string_list existing_refs = { NULL, 0, 0, 0 };
654+
struct string_list existing_refs = STRING_LIST_INIT_NODUP;
655655
struct string_list_item *peer_item = NULL;
656656
struct ref *ref_map;
657657
struct ref *rm;
@@ -875,7 +875,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
875875
int cmd_fetch(int argc, const char **argv, const char *prefix)
876876
{
877877
int i;
878-
struct string_list list = { NULL, 0, 0, 0 };
878+
struct string_list list = STRING_LIST_INIT_NODUP;
879879
struct remote *remote;
880880
int result = 0;
881881

builtin/fmt-merge-msg.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ void init_src_data(struct src_data *data)
3838
data->generic.strdup_strings = 1;
3939
}
4040

41-
static struct string_list srcs = { NULL, 0, 0, 1 };
42-
static struct string_list origins = { NULL, 0, 0, 1 };
41+
static struct string_list srcs = STRING_LIST_INIT_DUP;
42+
static struct string_list origins = STRING_LIST_INIT_DUP;
4343

4444
static int handle_line(char *line)
4545
{
@@ -146,7 +146,7 @@ static void shortlog(const char *name, unsigned char *sha1,
146146
int i, count = 0;
147147
struct commit *commit;
148148
struct object *branch;
149-
struct string_list subjects = { NULL, 0, 0, 1 };
149+
struct string_list subjects = STRING_LIST_INIT_DUP;
150150
int flags = UNINTERESTING | TREESAME | SEEN | SHOWN | ADDED;
151151
struct strbuf sb = STRBUF_INIT;
152152

builtin/grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
836836
struct grep_opt opt;
837837
struct object_array list = { 0, 0, NULL };
838838
const char **paths = NULL;
839-
struct string_list path_list = { NULL, 0, 0, 0 };
839+
struct string_list path_list = STRING_LIST_INIT_NODUP;
840840
int i;
841841
int dummy;
842842
int nongit = 0, use_index = 1;

builtin/mailsplit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static int split_maildir(const char *maildir, const char *dir,
137137
char name[PATH_MAX];
138138
int ret = -1;
139139
int i;
140-
struct string_list list = {NULL, 0, 0, 1};
140+
struct string_list list = STRING_LIST_INIT_DUP;
141141

142142
if (populate_maildir_list(&list, maildir) < 0)
143143
goto out;

builtin/mv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
6363
const char **source, **destination, **dest_path;
6464
enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
6565
struct stat st;
66-
struct string_list src_for_dst = {NULL, 0, 0, 0};
66+
struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
6767

6868
git_config(git_default_config, NULL);
6969

builtin/receive-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)
530530
static void check_aliased_updates(struct command *commands)
531531
{
532532
struct command *cmd;
533-
struct string_list ref_list = { NULL, 0, 0, 0 };
533+
struct string_list ref_list = STRING_LIST_INIT_NODUP;
534534

535535
for (cmd = commands; cmd; cmd = cmd->next) {
536536
struct string_list_item *item =

builtin/remote.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static int add_branch(const char *key, const char *branchname,
134134
static int add(int argc, const char **argv)
135135
{
136136
int fetch = 0, mirror = 0, fetch_tags = TAGS_DEFAULT;
137-
struct string_list track = { NULL, 0, 0 };
137+
struct string_list track = STRING_LIST_INIT_NODUP;
138138
const char *master = NULL;
139139
struct remote *remote;
140140
struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT;
@@ -596,7 +596,7 @@ static int mv(int argc, const char **argv)
596596
};
597597
struct remote *oldremote, *newremote;
598598
struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT, buf3 = STRBUF_INIT;
599-
struct string_list remote_branches = { NULL, 0, 0, 0 };
599+
struct string_list remote_branches = STRING_LIST_INIT_NODUP;
600600
struct rename_info rename;
601601
int i;
602602

@@ -734,8 +734,8 @@ static int rm(int argc, const char **argv)
734734
struct remote *remote;
735735
struct strbuf buf = STRBUF_INIT;
736736
struct known_remotes known_remotes = { NULL, NULL };
737-
struct string_list branches = { NULL, 0, 0, 1 };
738-
struct string_list skipped = { NULL, 0, 0, 1 };
737+
struct string_list branches = STRING_LIST_INIT_DUP;
738+
struct string_list skipped = STRING_LIST_INIT_DUP;
739739
struct branches_for_remote cb_data;
740740
int i, result;
741741

@@ -1044,7 +1044,7 @@ static int show(int argc, const char **argv)
10441044
OPT_END()
10451045
};
10461046
struct ref_states states;
1047-
struct string_list info_list = { NULL, 0, 0, 0 };
1047+
struct string_list info_list = STRING_LIST_INIT_NODUP;
10481048
struct show_info info;
10491049

10501050
argc = parse_options(argc, argv, NULL, options, builtin_remote_show_usage,
@@ -1483,7 +1483,7 @@ static int get_one_entry(struct remote *remote, void *priv)
14831483

14841484
static int show_all(void)
14851485
{
1486-
struct string_list list = { NULL, 0, 0 };
1486+
struct string_list list = STRING_LIST_INIT_NODUP;
14871487
int result;
14881488

14891489
list.strdup_strings = 1;

builtin/rerere.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static int git_rerere_gc_config(const char *var, const char *value, void *cb)
4040

4141
static void garbage_collect(struct string_list *rr)
4242
{
43-
struct string_list to_remove = { NULL, 0, 0, 1 };
43+
struct string_list to_remove = STRING_LIST_INIT_DUP;
4444
DIR *dir;
4545
struct dirent *e;
4646
int i, cutoff;
@@ -102,7 +102,7 @@ static int diff_two(const char *file1, const char *label1,
102102

103103
int cmd_rerere(int argc, const char **argv, const char *prefix)
104104
{
105-
struct string_list merge_rr = { NULL, 0, 0, 1 };
105+
struct string_list merge_rr = STRING_LIST_INIT_DUP;
106106
int i, fd, flags = 0;
107107

108108
if (2 < argc) {

builtin/show-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static int add_existing(const char *refname, const unsigned char *sha1, int flag
120120
*/
121121
static int exclude_existing(const char *match)
122122
{
123-
static struct string_list existing_refs = { NULL, 0, 0, 0 };
123+
static struct string_list existing_refs = STRING_LIST_INIT_NODUP;
124124
char buf[1024];
125125
int matchlen = match ? strlen(match) : 0;
126126

0 commit comments

Comments
 (0)