Skip to content

Commit 2fff1e1

Browse files
hashplinggitster
authored andcommitted
grep: fix NO_LIBPCRE1_JIT to fully disable JIT
If you have a pcre1 library which is compiled with JIT enabled then PCRE_STUDY_JIT_COMPILE will be defined whether or not the NO_LIBPCRE1_JIT configuration is set. This means that we enable JIT functionality when calling pcre_study even if NO_LIBPCRE1_JIT has been explicitly set and we just use plain pcre_exec later. Fix this by using own macro (GIT_PCRE_STUDY_JIT_COMPILE) which we set to PCRE_STUDY_JIT_COMPILE only if NO_LIBPCRE1_JIT is not set and define to 0 otherwise, as before. Reviewed-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 674ad93 commit 2fff1e1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)
380380
if (!p->pcre1_regexp)
381381
compile_regexp_failed(p, error);
382382

383-
p->pcre1_extra_info = pcre_study(p->pcre1_regexp, PCRE_STUDY_JIT_COMPILE, &error);
383+
p->pcre1_extra_info = pcre_study(p->pcre1_regexp, GIT_PCRE_STUDY_JIT_COMPILE, &error);
384384
if (!p->pcre1_extra_info && error)
385385
die("%s", error);
386386

grep.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
#if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
88
#ifndef NO_LIBPCRE1_JIT
99
#define GIT_PCRE1_USE_JIT
10+
#define GIT_PCRE_STUDY_JIT_COMPILE PCRE_STUDY_JIT_COMPILE
1011
#endif
1112
#endif
1213
#endif
13-
#ifndef PCRE_STUDY_JIT_COMPILE
14-
#define PCRE_STUDY_JIT_COMPILE 0
14+
#ifndef GIT_PCRE_STUDY_JIT_COMPILE
15+
#define GIT_PCRE_STUDY_JIT_COMPILE 0
1516
#endif
1617
#if PCRE_MAJOR <= 8 && PCRE_MINOR < 20
1718
typedef int pcre_jit_stack;

0 commit comments

Comments
 (0)