builtin/ls-remote.c: rearrange xcalloc arguments
[gitweb.git] / dir.c
diff --git a/dir.c b/dir.c
index 6c6a5d13c2e65b02bfd9e3201c35b3a9f270d093..eb6f581270f81a2e844e3396f966e67d06d27f41 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -49,16 +49,18 @@ int strncmp_icase(const char *a, const char *b, size_t count)
 
 int fnmatch_icase(const char *pattern, const char *string, int flags)
 {
-       return fnmatch(pattern, string, flags | (ignore_case ? FNM_CASEFOLD : 0));
+       return wildmatch(pattern, string,
+                        flags | (ignore_case ? WM_CASEFOLD : 0),
+                        NULL);
 }
 
-inline int git_fnmatch(const struct pathspec_item *item,
-                      const char *pattern, const char *string,
-                      int prefix)
+int git_fnmatch(const struct pathspec_item *item,
+               const char *pattern, const char *string,
+               int prefix)
 {
        if (prefix > 0) {
                if (ps_strncmp(item, pattern, string, prefix))
-                       return FNM_NOMATCH;
+                       return WM_NOMATCH;
                pattern += prefix;
                string += prefix;
        }
@@ -76,8 +78,9 @@ inline int git_fnmatch(const struct pathspec_item *item,
                                 NULL);
        else
                /* wildmatch has not learned no FNM_PATHNAME mode yet */
-               return fnmatch(pattern, string,
-                              item->magic & PATHSPEC_ICASE ? FNM_CASEFOLD : 0);
+               return wildmatch(pattern, string,
+                                item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0,
+                                NULL);
 }
 
 static int fnmatch_icase_mem(const char *pattern, int patternlen,
@@ -1361,10 +1364,7 @@ static struct path_simplify *create_simplify(const char **pathspec)
 
        for (nr = 0 ; ; nr++) {
                const char *match;
-               if (nr >= alloc) {
-                       alloc = alloc_nr(alloc);
-                       simplify = xrealloc(simplify, alloc * sizeof(*simplify));
-               }
+               ALLOC_GROW(simplify, nr + 1, alloc);
                match = *pathspec++;
                if (!match)
                        break;