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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Charles Bailey committed
Nov 12, 2017 at 16:59 UTC
2fff1e196d9cf03a868e99da39ea21b7c18c65c5
2 files changed
+4
-3
grep.c
+1
-1
@@ -380,7 +380,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)
380
if (!p->pcre1_regexp)
381
compile_regexp_failed(p, error);
382
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);
384
if (!p->pcre1_extra_info && error)
385
die("%s", error);
386
grep.h
+3
-2
@@ -7,11 +7,12 @@
7
#if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
8
#ifndef NO_LIBPCRE1_JIT
9
#define GIT_PCRE1_USE_JIT
10
+#define GIT_PCRE_STUDY_JIT_COMPILE PCRE_STUDY_JIT_COMPILE
11
#endif
12
#endif
13
#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
16
#endif
17
#if PCRE_MAJOR <= 8 && PCRE_MINOR < 20
18
typedef int pcre_jit_stack;