Skip to content

Commit 09872f6

Browse files
avargitster
authored andcommitted
grep: create a "is_fixed" member in "grep_pat"
This change paves the way for later using this value the regex compile functions themselves. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8a35b54 commit 09872f6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

grep.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,6 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
606606
{
607607
int err;
608608
int regflags = REG_NEWLINE;
609-
int pat_is_fixed;
610609

611610
p->word_regexp = opt->word_regexp;
612611
p->ignore_case = opt->ignore_case;
@@ -615,11 +614,11 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
615614
if (memchr(p->pattern, 0, p->patternlen) && !opt->pcre2)
616615
die(_("given pattern contains NULL byte (via -f <file>). This is only supported with -P under PCRE v2"));
617616

618-
pat_is_fixed = is_fixed(p->pattern, p->patternlen);
619-
if (p->fixed || pat_is_fixed) {
617+
p->is_fixed = is_fixed(p->pattern, p->patternlen);
618+
if (p->fixed || p->is_fixed) {
620619
#ifdef USE_LIBPCRE2
621620
opt->pcre2 = 1;
622-
if (pat_is_fixed) {
621+
if (p->is_fixed) {
623622
compile_pcre2_pattern(p, opt);
624623
} else {
625624
/*

grep.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct grep_pat {
8888
pcre2_compile_context *pcre2_compile_context;
8989
uint32_t pcre2_jit_on;
9090
unsigned fixed:1;
91+
unsigned is_fixed:1;
9192
unsigned ignore_case:1;
9293
unsigned word_regexp:1;
9394
};

0 commit comments

Comments
 (0)