]> git.ipfire.org Git - thirdparty/git.git/commitdiff
wildmatch: remove unused wildopts parameter
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 22 Jun 2017 21:38:08 +0000 (21:38 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 24 Jun 2017 01:27:07 +0000 (18:27 -0700)
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>
16 files changed:
apply.c
builtin/describe.c
builtin/ls-remote.c
builtin/name-rev.c
builtin/reflog.c
builtin/replace.c
builtin/show-branch.c
config.c
diffcore-order.c
dir.c
ref-filter.c
refs.c
revision.c
t/helper/test-wildmatch.c
wildmatch.c
wildmatch.h

diff --git a/apply.c b/apply.c
index 679ed7732d2385c4d7704f60335514b2b5f75c39..bb411b5810d9550c16689bf77101e0f40c49ac6e 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -2077,7 +2077,7 @@ static int use_patch(struct apply_state *state, struct patch *p)
        /* See if it matches any of exclude/include rule */
        for (i = 0; i < state->limit_by_name.nr; i++) {
                struct string_list_item *it = &state->limit_by_name.items[i];
-               if (!wildmatch(it->string, pathname, 0, NULL))
+               if (!wildmatch(it->string, pathname, 0))
                        return (it->util != NULL);
        }
 
index 893c8789f4f563c58041040740384322e6ea205b..2fe05f5324ee5b25b59e911874569599f804fd0d 100644 (file)
@@ -142,7 +142,7 @@ static int get_name(const char *path, const struct object_id *oid, int flag, voi
                        return 0;
 
                for_each_string_list_item(item, &exclude_patterns) {
-                       if (!wildmatch(item->string, path + 10, 0, NULL))
+                       if (!wildmatch(item->string, path + 10, 0))
                                return 0;
                }
        }
@@ -158,7 +158,7 @@ static int get_name(const char *path, const struct object_id *oid, int flag, voi
                        return 0;
 
                for_each_string_list_item(item, &patterns) {
-                       if (!wildmatch(item->string, path + 10, 0, NULL))
+                       if (!wildmatch(item->string, path + 10, 0))
                                break;
 
                        /* If we get here, no pattern matched. */
index b2d7d5ce6841cf9cb9e310c659aac043ad00cfb0..c4be98ab9e84fdcde2842b88d4bb60600f7bf627 100644 (file)
@@ -24,7 +24,7 @@ static int tail_match(const char **pattern, const char *path)
 
        pathbuf = xstrfmt("/%s", path);
        while ((p = *(pattern++)) != NULL) {
-               if (!wildmatch(p, pathbuf, 0, NULL)) {
+               if (!wildmatch(p, pathbuf, 0)) {
                        free(pathbuf);
                        return 1;
                }
index 7fc7e66e8500b82cbfecc21a1dce77e09de28ab0..d21a5002a7ecbcb6e8921fdab1b1bfdd16dcbe7a 100644 (file)
@@ -129,7 +129,7 @@ static int subpath_matches(const char *path, const char *filter)
        const char *subpath = path;
 
        while (subpath) {
-               if (!wildmatch(filter, subpath, 0, NULL))
+               if (!wildmatch(filter, subpath, 0))
                        return subpath - path;
                subpath = strchr(subpath, '/');
                if (subpath)
index 920c16dac025b0f5650b0f91511c22359d5bda2d..96c82b4f5ef419f14425f47b2be699e7c87c3540 100644 (file)
@@ -485,7 +485,7 @@ static void set_reflog_expiry_param(struct cmd_reflog_expire_cb *cb, int slot, c
                return; /* both given explicitly -- nothing to tweak */
 
        for (ent = reflog_expire_cfg; ent; ent = ent->next) {
-               if (!wildmatch(ent->pattern, ref, 0, NULL)) {
+               if (!wildmatch(ent->pattern, ref, 0)) {
                        if (!(slot & EXPIRE_TOTAL))
                                cb->expire_total = ent->expire_total;
                        if (!(slot & EXPIRE_UNREACH))
index c921bc976f2299adc39277a21a74abbcc0c100f7..89262df5a19c3dcf9b39bb7f1be8c1df7e9305f0 100644 (file)
@@ -40,7 +40,7 @@ static int show_reference(const char *refname, const struct object_id *oid,
 {
        struct show_data *data = cb_data;
 
-       if (!wildmatch(data->pattern, refname, 0, NULL)) {
+       if (!wildmatch(data->pattern, refname, 0)) {
                if (data->format == REPLACE_FORMAT_SHORT)
                        printf("%s\n", refname);
                else if (data->format == REPLACE_FORMAT_MEDIUM)
index 3636a05594de18639bced97a1e18a128632bc00d..82f378e7f59f306499bf38f802f09187617dde00 100644 (file)
@@ -437,7 +437,7 @@ static int append_matching_ref(const char *refname, const struct object_id *oid,
                        slash--;
        if (!*tail)
                return 0;
-       if (wildmatch(match_ref_pattern, tail, 0, NULL))
+       if (wildmatch(match_ref_pattern, tail, 0))
                return 0;
        if (starts_with(refname, "refs/heads/"))
                return append_head_ref(refname, oid, flag, cb_data);
index 34a139c40bd57ff2dd23318beca53fd2e2948000..260caf27b87809363aa5ee4d1ffe4fd95ddb8874 100644 (file)
--- a/config.c
+++ b/config.c
@@ -245,7 +245,7 @@ again:
        }
 
        ret = !wildmatch(pattern.buf + prefix, text.buf + prefix,
-                        icase ? WM_CASEFOLD : 0, NULL);
+                        icase ? WM_CASEFOLD : 0);
 
        if (!ret && !already_tried_absolute) {
                /*
index 1957f822a5120a463ea4dff503fd8fe78f63b663..19e73311f9cd830da70428439b7b6a14d5345eec 100644 (file)
@@ -67,7 +67,7 @@ static int match_order(const char *path)
                strbuf_addstr(&p, path);
                while (p.buf[0]) {
                        char *cp;
-                       if (!wildmatch(order[i], p.buf, 0, NULL))
+                       if (!wildmatch(order[i], p.buf, 0))
                                return i;
                        cp = strrchr(p.buf, '/');
                        if (!cp)
diff --git a/dir.c b/dir.c
index 5f1afb56bc6e6d5dc5300380f980f4b2699ab08d..c64965f237461fd9a40a6850c6d74f65bd2c201e 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -91,13 +91,11 @@ int git_fnmatch(const struct pathspec_item *item,
        if (item->magic & PATHSPEC_GLOB)
                return wildmatch(pattern, string,
                                 WM_PATHNAME |
-                                (item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0),
-                                NULL);
+                                (item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0));
        else
                /* wildmatch has not learned no FNM_PATHNAME mode yet */
                return wildmatch(pattern, string,
-                                item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0,
-                                NULL);
+                                item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0);
 }
 
 static int fnmatch_icase_mem(const char *pattern, int patternlen,
@@ -121,7 +119,7 @@ static int fnmatch_icase_mem(const char *pattern, int patternlen,
 
        if (ignore_case)
                flags |= WM_CASEFOLD;
-       match_status = wildmatch(use_pat, use_str, flags, NULL);
+       match_status = wildmatch(use_pat, use_str, flags);
 
        strbuf_release(&pat_buf);
        strbuf_release(&str_buf);
index ab32bc9c3145c85c839c660c54b61f13fe9cb51a..718def443a0862c5ba90ce45b24abc22fa0aaf5b 100644 (file)
@@ -1624,7 +1624,7 @@ static int match_pattern(const struct ref_filter *filter, const char *refname)
               skip_prefix(refname, "refs/", &refname));
 
        for (; *patterns; patterns++) {
-               if (!wildmatch(*patterns, refname, flags, NULL))
+               if (!wildmatch(*patterns, refname, flags))
                        return 1;
        }
        return 0;
@@ -1655,7 +1655,7 @@ static int match_name_as_path(const struct ref_filter *filter, const char *refna
                     refname[plen] == '/' ||
                     p[plen-1] == '/'))
                        return 1;
-               if (!wildmatch(p, refname, WM_PATHNAME, NULL))
+               if (!wildmatch(p, refname, WM_PATHNAME))
                        return 1;
        }
        return 0;
diff --git a/refs.c b/refs.c
index f0685c92513e306188d89380a1c3020024a4edb4..32626a4cd144ff1e06896f246d0d88344000f841 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -229,7 +229,7 @@ static int filter_refs(const char *refname, const struct object_id *oid,
 {
        struct ref_filter *filter = (struct ref_filter *)data;
 
-       if (wildmatch(filter->pattern, refname, 0, NULL))
+       if (wildmatch(filter->pattern, refname, 0))
                return 0;
        return filter->fn(refname, oid, flags, filter->cb_data);
 }
index d81c08a1dee935acc373a58665b7a94c1869925f..4ab8344ee87cfcaa64c038411693f12ed3c38dc7 100644 (file)
@@ -1142,7 +1142,7 @@ int ref_excluded(struct string_list *ref_excludes, const char *path)
        if (!ref_excludes)
                return 0;
        for_each_string_list_item(item, ref_excludes) {
-               if (!wildmatch(item->string, path, 0, NULL))
+               if (!wildmatch(item->string, path, 0))
                        return 1;
        }
        return 0;
index 52be876fed3bcc3bb5a1def5de8febe8b29c0ec4..921d7b3e7ea20efe85f15beb7c75b8a5263267fb 100644 (file)
@@ -11,11 +11,11 @@ int cmd_main(int argc, const char **argv)
                        argv[i] += 3;
        }
        if (!strcmp(argv[1], "wildmatch"))
-               return !!wildmatch(argv[3], argv[2], WM_PATHNAME, NULL);
+               return !!wildmatch(argv[3], argv[2], WM_PATHNAME);
        else if (!strcmp(argv[1], "iwildmatch"))
-               return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD, NULL);
+               return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD);
        else if (!strcmp(argv[1], "pathmatch"))
-               return !!wildmatch(argv[3], argv[2], 0, NULL);
+               return !!wildmatch(argv[3], argv[2], 0);
        else
                return 1;
 }
index 57c876580592ab246d0c5c20cf20079d2097243c..d074c1be1046f1aba11d21eb5b66a738590bc712 100644 (file)
@@ -272,8 +272,7 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
 }
 
 /* Match the "pattern" against the "text" string. */
-int wildmatch(const char *pattern, const char *text,
-             unsigned int flags, struct wildopts *wo)
+int wildmatch(const char *pattern, const char *text, unsigned int flags)
 {
        return dowild((const uchar*)pattern, (const uchar*)text, flags);
 }
index 4090c8f4bb0587d36ec01069f1e8d832ea46d7d6..b8c826aa684ec2cb0251af8e24a89689d66614b1 100644 (file)
@@ -10,9 +10,5 @@
 #define WM_ABORT_ALL -1
 #define WM_ABORT_TO_STARSTAR -2
 
-struct wildopts;
-
-int wildmatch(const char *pattern, const char *text,
-             unsigned int flags,
-             struct wildopts *wo);
+int wildmatch(const char *pattern, const char *text, unsigned int flags);
 #endif