From 4804b00e8f50e446be43ee51863c8cdd3c743bea Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Thu, 30 Jun 2022 17:37:51 +0100 Subject: [PATCH] Add an #ifdef to avoid the need even to link with pcre2_jit_compile.o when JIT is not supported --- ChangeLog | 5 +++++ src/pcre2_compile.c | 2 ++ src/pcre2test.c | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3cf9d24..25d2d0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,11 @@ pcre2test. 6. Change a number of int variables that hold buffer and line lengths in pcre2grep to PCRE2_SIZE (aka size_t). +7. Added an #ifdef to cut out a call to PRIV(jit_free) when JIT is not +supported (even though that function would do nothing in that case) at the +request of a user who doesn't even want to link with pcre_jit_compile.o. Also +tidied up an untidy #ifdef arrangement in pcre2test. + Version 10.40 15-April-2022 --------------------------- diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index d9eb7e5..f508e68 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -1266,8 +1266,10 @@ PCRE2_SIZE* ref_count; if (code != NULL) { +#ifdef SUPPORT_JIT if (code->executable_jit != NULL) PRIV(jit_free)(code->executable_jit, &code->memctl); +#endif if ((code->flags & PCRE2_DEREF_TABLES) != 0) { diff --git a/src/pcre2test.c b/src/pcre2test.c index 1450e11..00516fb 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -4755,19 +4755,19 @@ if ((pat_patctl.control & CTL_INFO) != 0) if (pat_patctl.jit != 0 && (pat_patctl.control & CTL_JITVERIFY) != 0) { +#ifdef SUPPORT_JIT if (FLD(compiled_code, executable_jit) != NULL) fprintf(outfile, "JIT compilation was successful\n"); else { -#ifdef SUPPORT_JIT fprintf(outfile, "JIT compilation was not successful"); if (jitrc != 0 && !print_error_message(jitrc, " (", ")")) return PR_ABEND; fprintf(outfile, "\n"); + } #else fprintf(outfile, "JIT support is not available in this version of PCRE2\n"); #endif - } } }