git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] grep: don't call regexec() for fixed strings

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 12, 2009, 13:33 UTC
Message-ID
<alpine.DEB.1.00.0901121433240.3586@pacific.mpi-cbg.de>
In-Reply-To
<237967ef0901120425x79b7c1a4p238081a99694ae23@mail.gmail.com>
Hi,
On Mon, 12 Jan 2009, Mikael Magnusson wrote:
Show 20 quoted lines
> 2009/1/10 René Scharfe <rene.scharfe@lsrfire.ath.cx>:
> > Add the new flag "fixed" to struct grep_pat and set it if the pattern
> > is doesn't contain any regex control characters in addition to if the
> > flag -F/--fixed-strings was specified.
> >
> > diff --git a/grep.c b/grep.c
> > index 394703b..a1092df 100644
> > --- a/grep.c
> > +++ b/grep.c
> > @@ -28,9 +28,31 @@ void append_grep_pattern(struct grep_opt *opt, const char *pat,
> >        p->next = NULL;
> >  }
> >
> > +static int isregexspecial(int c)
> > +{
> > +       return isspecial(c) || c == '$' || c == '(' || c == ')' || c == '+' ||
> > +                              c == '.' || c == '^' || c == '{' || c == '|';
> > +}
> 
> Shouldn't this include '*' and '\'?
This is covered by isspecial(): see ctype.c.

Hth, Dscho

Previous: Mikael MagnussonNext: Alex Riesen
Message 5 of 12 in “grep -w: forward to next possible position after rejected match”
  1. 1/2 grep -w: forward to next possible position after rejected matchRené Scharfe, Jan 9, 2009
  2. 2/2 grep: don't call regexec() for fixed stringsRené Scharfe, Jan 9, 2009
  3. Junio C HamanoJan 10, 2009
  4. Mikael MagnussonJan 12, 2009
  5. Johannes SchindelinJan 12, 2009
  6. Alex RiesenJan 12, 2009
  7. René ScharfeJan 12, 2009
  8. Junio C HamanoJan 13, 2009
  9. 1/4 Add ctype testRené Scharfe, Jan 17, 2009
  10. 2/4 Reformat ctype.cRené Scharfe, Jan 17, 2009
  11. 3/4 Change NUL char handling of isspecial()René Scharfe, Jan 17, 2009
  12. 4/4 Add is_regex_special()René Scharfe, Jan 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.