bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Exclude optimization


From: Ralf Wildenhues
Subject: Re: [PATCH] Exclude optimization
Date: Tue, 11 Aug 2009 19:20:27 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

Hello Sergey,

* Sergey Poznyakoff wrote on Tue, Aug 11, 2009 at 03:07:03PM CEST:
> --- a/lib/exclude.c
> +++ b/lib/exclude.c

> +
> +/* Return true if str has wildcard characters */
> +bool
> +fnmatch_pattern_has_wildcards (const char *str, int options)
> +{
> +  char *cset = "\\?*[]";
> +  if (options & FNM_NOESCAPE)
> +    cset++;
> +  while (*str)
> +    {
> +      size_t n = strcspn (str, cset);
> +      if (str[n] == 0)
> +     break;
> +      else if (str[n] == '\\')
> +     {
> +       str += n + 1;
> +       if (*str)
> +         str++;
> +     }
> +      else
> +     return true;
> +    }
> +  return false;
> +}

This would seem to still mis-characterizes patterns such as 'foo]'.
Please omit the ] from cset.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]