diff --git a/ChangeLog b/ChangeLog index 62f2436..4adde74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -67,6 +67,11 @@ PCRE2_STATIC_RUNTIME). Fix from David Gaussmann. expansion when long lines are encountered. Original patch by Dmitry Cherniachenko. +11. If pcre2grep was compiled with JIT support, but the library was compiled +without it (something that neither ./configure nor CMake allow, but it can be +done by editing config.h), pcre2grep was giving a JIT error. Now it detects +this situation and does not try to use JIT. + Version 10.22 29-July-2016 -------------------------- diff --git a/NON-AUTOTOOLS-BUILD b/NON-AUTOTOOLS-BUILD index ceb9245..e3cf813 100644 --- a/NON-AUTOTOOLS-BUILD +++ b/NON-AUTOTOOLS-BUILD @@ -174,7 +174,11 @@ can skip ahead to the CMake section. (11) If you want to use the pcre2grep command, compile and link src/pcre2grep.c; it uses only the basic 8-bit PCRE2 library (it does not - need the pcre2posix library). + need the pcre2posix library). If you have built the PCRE2 library with JIT + support by defining SUPPORT_JIT in src/config.h, you can also define + SUPPORT_PCRE2GREP_JIT, which causes pcre2grep to make use of JIT (unless + it is run with --no-jit). If you define SUPPORT_PCRE2GREP_JIT without + defining SUPPORT_JIT, pcre2grep does not try to make use of JIT. STACK SIZE IN WINDOWS ENVIRONMENTS @@ -389,4 +393,4 @@ and executable, is in EBCDIC and native z/OS file formats and this is the recommended download site. ============================= -Last Updated: 16 July 2015 +Last Updated: 13 October 2016 diff --git a/src/pcre2grep.c b/src/pcre2grep.c index aa8c5c2..67330d1 100644 --- a/src/pcre2grep.c +++ b/src/pcre2grep.c @@ -3460,6 +3460,16 @@ if (jfriedl_XT != 0 || jfriedl_XR != 0) } #endif +/* If use_jit is set, check whether JIT is available. If not, do not try +to use JIT. */ + +if (use_jit) + { + uint32_t answer; + (void)pcre2_config(PCRE2_CONFIG_JIT, &answer); + if (!answer) use_jit = FALSE; + } + /* Get memory for the main buffer. */ if (bufthird <= 0)