Skip to content

Commit

Permalink
grep: under --debug, show whether PCRE JIT is enabled
Browse files Browse the repository at this point in the history
This information is useful and not visible anywhere else, so show it.

Signed-off-by: Beat Bolli <[email protected]>
Suggested-by: Johannes Schindelin <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
bbolli authored and gitster committed Aug 19, 2019
1 parent 870eea8 commit c581e4a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)

#ifdef GIT_PCRE1_USE_JIT
pcre_config(PCRE_CONFIG_JIT, &p->pcre1_jit_on);
if (opt->debug)
fprintf(stderr, "pcre1_jit_on=%d\n", p->pcre1_jit_on);
#endif
}

Expand Down Expand Up @@ -490,6 +492,8 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
}

pcre2_config(PCRE2_CONFIG_JIT, &p->pcre2_jit_on);
if (opt->debug)
fprintf(stderr, "pcre2_jit_on=%d\n", p->pcre2_jit_on);
if (p->pcre2_jit_on) {
jitret = pcre2_jit_compile(p->pcre2_pattern, PCRE2_JIT_COMPLETE);
if (jitret)
Expand All @@ -515,6 +519,9 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
BUG("pcre2_pattern_info() failed: %d", patinforet);
if (jitsizearg == 0) {
p->pcre2_jit_on = 0;
if (opt->debug)
fprintf(stderr, "pcre2_jit_on=%d: (*NO_JIT) in regex\n",
p->pcre2_jit_on);
return;
}
}
Expand Down

0 comments on commit c581e4a

Please sign in to comment.