dir.c: get rid of the wildcard symbol set in no_wildcard()

Elsewhere in this file is_glob_special() is also used to check for wildcards, which is defined in ctype. Make no_wildcard() also use this function (indirectly via simple_length()) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Jun 7, 2012 at 14:53 UTC fcd631ed84d61147b7cc8996cde533f8a8d1fca0
1 file changed +16 -16
dir.c
+16 -16
@@ -288,9 +288,24 @@ int match_pathspec_depth(const struct pathspec *ps,
288 return retval;
289 }
290
291 +/*
292 + * Return the length of the "simple" part of a path match limiter.
293 + */
294 +static int simple_length(const char *match)
295 +{
296 + int len = -1;
297 +
298 + for (;;) {
299 + unsigned char c = *match++;
300 + len++;
301 + if (c == '\0' || is_glob_special(c))
302 + return len;
303 + }
304 +}
305 +
306 static int no_wildcard(const char *string)
307 {
293 - return string[strcspn(string, "*?[{\\")] == '\0';
308 + return string[simple_length(string)] == '\0';
309 }
310
311 void add_exclude(const char *string, const char *base,
@@ -997,21 +1012,6 @@ static int cmp_name(const void *p1, const void *p2)
1012 e2->name, e2->len);
1013 }
1014
1000 -/*
1001 - * Return the length of the "simple" part of a path match limiter.
1002 - */
1003 -static int simple_length(const char *match)
1004 -{
1005 - int len = -1;
1006 -
1007 - for (;;) {
1008 - unsigned char c = *match++;
1009 - len++;
1010 - if (c == '\0' || is_glob_special(c))
1011 - return len;
1012 - }
1013 -}
1014 -
1015 static struct path_simplify *create_simplify(const char **pathspec)
1016 {
1017 int nr, alloc = 0;