From f9b7cce61cbd19c99e89b859b5909f0741111185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 17 Jan 2009 16:50:37 +0100 Subject: Add is_regex_special() Add is_regex_special(), a character class macro for chars that have a special meaning in regular expressions. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- grep.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'grep.c') diff --git a/grep.c b/grep.c index f9a45258a..062b2b6f2 100644 --- a/grep.c +++ b/grep.c @@ -28,16 +28,9 @@ void append_grep_pattern(struct grep_opt *opt, const char *pat, p->next = NULL; } -static int isregexspecial(int c) -{ - return c == '\0' || is_glob_special(c) || - c == '$' || c == '(' || c == ')' || c == '+' || - c == '.' || c == '^' || c == '{' || c == '|'; -} - static int is_fixed(const char *s) { - while (!isregexspecial(*s)) + while (*s && !is_regex_special(*s)) s++; return !*s; } -- cgit v1.2.1