Skip to content

Commit c581e4a

Browse files
bbolligitster
authored andcommitted
grep: under --debug, show whether PCRE JIT is enabled
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]>
1 parent 870eea8 commit c581e4a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

grep.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)
394394

395395
#ifdef GIT_PCRE1_USE_JIT
396396
pcre_config(PCRE_CONFIG_JIT, &p->pcre1_jit_on);
397+
if (opt->debug)
398+
fprintf(stderr, "pcre1_jit_on=%d\n", p->pcre1_jit_on);
397399
#endif
398400
}
399401

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

492494
pcre2_config(PCRE2_CONFIG_JIT, &p->pcre2_jit_on);
495+
if (opt->debug)
496+
fprintf(stderr, "pcre2_jit_on=%d\n", p->pcre2_jit_on);
493497
if (p->pcre2_jit_on) {
494498
jitret = pcre2_jit_compile(p->pcre2_pattern, PCRE2_JIT_COMPLETE);
495499
if (jitret)
@@ -515,6 +519,9 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
515519
BUG("pcre2_pattern_info() failed: %d", patinforet);
516520
if (jitsizearg == 0) {
517521
p->pcre2_jit_on = 0;
522+
if (opt->debug)
523+
fprintf(stderr, "pcre2_jit_on=%d: (*NO_JIT) in regex\n",
524+
p->pcre2_jit_on);
518525
return;
519526
}
520527
}

0 commit comments

Comments
 (0)