Re: [PATCH 2/2] grep: don't call regexec() for fixed strings
- From
Alex Riesen <raa.lkml@gmail.com>
- Date
- Jan 12, 2009, 15:32 UTC
- Message-ID
- <81b0412b0901120732t1bd1978awdc4be47767e02863@mail.gmail.com>
- In-Reply-To
- <4967DB4A.2000702@lsrfire.ath.cx>
2009/1/10 René Scharfe <rene.scharfe@lsrfire.ath.cx>:
Show 12 quoted lines
> +static int isregexspecial(int c)
> +{
> + return isspecial(c) || c == '$' || c == '(' || c == ')' || c == '+' ||
> + c == '.' || c == '^' || c == '{' || c == '|';
> +}
> +
> +static int is_fixed(const char *s)
> +{
> + while (!isregexspecial(*s))
> + s++;
> + return !*s;
> +}strchr?