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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
8cc3299262
commit
f9b7cce61c
9
grep.c
9
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user