Hello Sergey,
* Sergey Poznyakoff wrote on Sun, Aug 09, 2009 at 11:25:51PM CEST:
> The proposed patch considerably speed-ups the exclude module
> for large exclusion lists of non-wildcard patterns. Ok to push?
> --- a/lib/exclude.c
> +++ b/lib/exclude.c
> +/* Return true if str is a fnmatch pattern */
> +bool
> +is_fnmatch_pattern (const char *str)
> +{
> + while (*str)
> + {
> + size_t n = strcspn (str, "?*[]");
Why does this contain a search for ']'? A closing bracket on its own is
not special in a glob.
> + if (str[n] == 0)
> + break;
> + else if (n > 0 && str[n-1] == '\\')
> + str += n + 1;
I think Bruno already mentioned that you need to walk through the string
in order to be able to decide whether a backslash is an escaping one.
> + else
> + return true;
> + }
> + return false;
> +}
Cheers,
Ralf