wildmatch: remove unused wildopts parameter

Remove the unused wildopts placeholder struct from being passed to all wildmatch() invocations, or rather remove all the boilerplate NULL parameters. This parameter was added back in commit 9b3497cab9 ("wildmatch: rename constants and update prototype", 2013-01-01) as a placeholder for future use. Over 4 years later nothing has made use of it, let's just remove it. It can be added in the future if we find some reason to start using such a parameter. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jun 22, 2017 at 21:38 UTC 55d3426929d4d8c3dec402cabe6fb1bf27d6abad
16 files changed +22 -29
apply.c
+1 -1
@@ -2077,7 +2077,7 @@ static int use_patch(struct apply_state *state, struct patch *p)
2077 /* See if it matches any of exclude/include rule */
2078 for (i = 0; i < state->limit_by_name.nr; i++) {
2079 struct string_list_item *it = &state->limit_by_name.items[i];
2080 - if (!wildmatch(it->string, pathname, 0, NULL))
2080 + if (!wildmatch(it->string, pathname, 0))
2081 return (it->util != NULL);
2082 }
2083
builtin/describe.c
+2 -2
@@ -142,7 +142,7 @@ static int get_name(const char *path, const struct object_id *oid, int flag, voi
142 return 0;
143
144 for_each_string_list_item(item, &exclude_patterns) {
145 - if (!wildmatch(item->string, path + 10, 0, NULL))
145 + if (!wildmatch(item->string, path + 10, 0))
146 return 0;
147 }
148 }
@@ -158,7 +158,7 @@ static int get_name(const char *path, const struct object_id *oid, int flag, voi
158 return 0;
159
160 for_each_string_list_item(item, &patterns) {
161 - if (!wildmatch(item->string, path + 10, 0, NULL))
161 + if (!wildmatch(item->string, path + 10, 0))
162 break;
163
164 /* If we get here, no pattern matched. */
builtin/ls-remote.c
+1 -1
@@ -24,7 +24,7 @@ static int tail_match(const char **pattern, const char *path)
24
25 pathbuf = xstrfmt("/%s", path);
26 while ((p = *(pattern++)) != NULL) {
27 - if (!wildmatch(p, pathbuf, 0, NULL)) {
27 + if (!wildmatch(p, pathbuf, 0)) {
28 free(pathbuf);
29 return 1;
30 }
builtin/name-rev.c
+1 -1
@@ -129,7 +129,7 @@ static int subpath_matches(const char *path, const char *filter)
129 const char *subpath = path;
130
131 while (subpath) {
132 - if (!wildmatch(filter, subpath, 0, NULL))
132 + if (!wildmatch(filter, subpath, 0))
133 return subpath - path;
134 subpath = strchr(subpath, '/');
135 if (subpath)
builtin/reflog.c
+1 -1
@@ -485,7 +485,7 @@ static void set_reflog_expiry_param(struct cmd_reflog_expire_cb *cb, int slot, c
485 return; /* both given explicitly -- nothing to tweak */
486
487 for (ent = reflog_expire_cfg; ent; ent = ent->next) {
488 - if (!wildmatch(ent->pattern, ref, 0, NULL)) {
488 + if (!wildmatch(ent->pattern, ref, 0)) {
489 if (!(slot & EXPIRE_TOTAL))
490 cb->expire_total = ent->expire_total;
491 if (!(slot & EXPIRE_UNREACH))
builtin/replace.c
+1 -1
@@ -40,7 +40,7 @@ static int show_reference(const char *refname, const struct object_id *oid,
40 {
41 struct show_data *data = cb_data;
42
43 - if (!wildmatch(data->pattern, refname, 0, NULL)) {
43 + if (!wildmatch(data->pattern, refname, 0)) {
44 if (data->format == REPLACE_FORMAT_SHORT)
45 printf("%s\n", refname);
46 else if (data->format == REPLACE_FORMAT_MEDIUM)
builtin/show-branch.c
+1 -1
@@ -437,7 +437,7 @@ static int append_matching_ref(const char *refname, const struct object_id *oid,
437 slash--;
438 if (!*tail)
439 return 0;
440 - if (wildmatch(match_ref_pattern, tail, 0, NULL))
440 + if (wildmatch(match_ref_pattern, tail, 0))
441 return 0;
442 if (starts_with(refname, "refs/heads/"))
443 return append_head_ref(refname, oid, flag, cb_data);
config.c
+1 -1
@@ -245,7 +245,7 @@ again:
245 }
246
247 ret = !wildmatch(pattern.buf + prefix, text.buf + prefix,
248 - icase ? WM_CASEFOLD : 0, NULL);
248 + icase ? WM_CASEFOLD : 0);
249
250 if (!ret && !already_tried_absolute) {
251 /*
diffcore-order.c
+1 -1
@@ -67,7 +67,7 @@ static int match_order(const char *path)
67 strbuf_addstr(&p, path);
68 while (p.buf[0]) {
69 char *cp;
70 - if (!wildmatch(order[i], p.buf, 0, NULL))
70 + if (!wildmatch(order[i], p.buf, 0))
71 return i;
72 cp = strrchr(p.buf, '/');
73 if (!cp)
dir.c
+3 -5
@@ -91,13 +91,11 @@ int git_fnmatch(const struct pathspec_item *item,
91 if (item->magic & PATHSPEC_GLOB)
92 return wildmatch(pattern, string,
93 WM_PATHNAME |
94 - (item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0),
95 - NULL);
94 + (item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0));
95 else
96 /* wildmatch has not learned no FNM_PATHNAME mode yet */
97 return wildmatch(pattern, string,
99 - item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0,
100 - NULL);
98 + item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0);
99 }
100
101 static int fnmatch_icase_mem(const char *pattern, int patternlen,
@@ -121,7 +119,7 @@ static int fnmatch_icase_mem(const char *pattern, int patternlen,
119
120 if (ignore_case)
121 flags |= WM_CASEFOLD;
124 - match_status = wildmatch(use_pat, use_str, flags, NULL);
122 + match_status = wildmatch(use_pat, use_str, flags);
123
124 strbuf_release(&pat_buf);
125 strbuf_release(&str_buf);
ref-filter.c
+2 -2
@@ -1624,7 +1624,7 @@ static int match_pattern(const struct ref_filter *filter, const char *refname)
1624 skip_prefix(refname, "refs/", &refname));
1625
1626 for (; *patterns; patterns++) {
1627 - if (!wildmatch(*patterns, refname, flags, NULL))
1627 + if (!wildmatch(*patterns, refname, flags))
1628 return 1;
1629 }
1630 return 0;
@@ -1655,7 +1655,7 @@ static int match_name_as_path(const struct ref_filter *filter, const char *refna
1655 refname[plen] == '/' ||
1656 p[plen-1] == '/'))
1657 return 1;
1658 - if (!wildmatch(p, refname, WM_PATHNAME, NULL))
1658 + if (!wildmatch(p, refname, WM_PATHNAME))
1659 return 1;
1660 }
1661 return 0;
refs.c
+1 -1
@@ -229,7 +229,7 @@ static int filter_refs(const char *refname, const struct object_id *oid,
229 {
230 struct ref_filter *filter = (struct ref_filter *)data;
231
232 - if (wildmatch(filter->pattern, refname, 0, NULL))
232 + if (wildmatch(filter->pattern, refname, 0))
233 return 0;
234 return filter->fn(refname, oid, flags, filter->cb_data);
235 }
revision.c
+1 -1
@@ -1142,7 +1142,7 @@ int ref_excluded(struct string_list *ref_excludes, const char *path)
1142 if (!ref_excludes)
1143 return 0;
1144 for_each_string_list_item(item, ref_excludes) {
1145 - if (!wildmatch(item->string, path, 0, NULL))
1145 + if (!wildmatch(item->string, path, 0))
1146 return 1;
1147 }
1148 return 0;
t/helper/test-wildmatch.c
+3 -3
@@ -11,11 +11,11 @@ int cmd_main(int argc, const char **argv)
11 argv[i] += 3;
12 }
13 if (!strcmp(argv[1], "wildmatch"))
14 - return !!wildmatch(argv[3], argv[2], WM_PATHNAME, NULL);
14 + return !!wildmatch(argv[3], argv[2], WM_PATHNAME);
15 else if (!strcmp(argv[1], "iwildmatch"))
16 - return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD, NULL);
16 + return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD);
17 else if (!strcmp(argv[1], "pathmatch"))
18 - return !!wildmatch(argv[3], argv[2], 0, NULL);
18 + return !!wildmatch(argv[3], argv[2], 0);
19 else
20 return 1;
21 }
wildmatch.c
+1 -2
@@ -272,8 +272,7 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
272 }
273
274 /* Match the "pattern" against the "text" string. */
275 -int wildmatch(const char *pattern, const char *text,
276 - unsigned int flags, struct wildopts *wo)
275 +int wildmatch(const char *pattern, const char *text, unsigned int flags)
276 {
277 return dowild((const uchar*)pattern, (const uchar*)text, flags);
278 }
wildmatch.h
+1 -5
@@ -10,9 +10,5 @@
10 #define WM_ABORT_ALL -1
11 #define WM_ABORT_TO_STARSTAR -2
12
13 -struct wildopts;
14 -
15 -int wildmatch(const char *pattern, const char *text,
16 - unsigned int flags,
17 - struct wildopts *wo);
13 +int wildmatch(const char *pattern, const char *text, unsigned int flags);
14 #endif