From: Mikael Magnusson <mikachu@gmail.com>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] grep: don't call regexec() for fixed strings
Date: Mon, 12 Jan 2009 13:25:11 +0100 [thread overview]
Message-ID: <237967ef0901120425x79b7c1a4p238081a99694ae23@mail.gmail.com> (raw)
In-Reply-To: <4967DB4A.2000702@lsrfire.ath.cx>
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 '\'?
--
Mikael Magnusson
next prev parent reply other threads:[~2009-01-12 12:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-09 23:08 [PATCH 1/2] grep -w: forward to next possible position after rejected match René Scharfe
2009-01-09 23:18 ` [PATCH 2/2] grep: don't call regexec() for fixed strings René Scharfe
2009-01-10 20:37 ` Junio C Hamano
2009-01-12 12:25 ` Mikael Magnusson [this message]
2009-01-12 13:33 ` Johannes Schindelin
2009-01-12 15:32 ` Alex Riesen
2009-01-12 19:18 ` René Scharfe
2009-01-13 8:13 ` Junio C Hamano
2009-01-17 15:50 ` [PATCH 1/4] Add ctype test René Scharfe
2009-01-17 15:50 ` [PATCH 2/4] Reformat ctype.c René Scharfe
2009-01-17 15:50 ` [PATCH 3/4] Change NUL char handling of isspecial() René Scharfe
2009-01-17 15:50 ` [PATCH 4/4] Add is_regex_special() René Scharfe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=237967ef0901120425x79b7c1a4p238081a99694ae23@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rene.scharfe@lsrfire.ath.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).