From: Alex Riesen Date: Mon, 12 Jan 2009 15:32:36 GMT Subject: Re: [PATCH 2/2] grep: don't call regexec() for fixed strings Message-ID: <81b0412b0901120732t1bd1978awdc4be47767e02863@mail.gmail.com> In-Reply-To: <4967DB4A.2000702@lsrfire.ath.cx> 2009/1/10 René Scharfe : > +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?