diff options
author | Philip Hazel <Philip.Hazel@gmail.com> | 2023-12-29 14:57:07 +0000 |
---|---|---|
committer | Philip Hazel <Philip.Hazel@gmail.com> | 2023-12-29 14:57:07 +0000 |
commit | 78b7c5b346d256a2bb60de040f6350064c8adaa5 (patch) | |
tree | cc503294a64c2381ea1cbde421629c6bfaba8f99 | |
parent | aadef0c3b4647e6d32ed95eea2487db990c4f183 (diff) | |
download | pcre-78b7c5b346d256a2bb60de040f6350064c8adaa5.tar.gz |
Ensure jitfast is used when set with replace in pcre2test
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/pcre2test.c | 18 | ||||
-rw-r--r-- | testdata/testinput17 | 3 | ||||
-rw-r--r-- | testdata/testoutput17 | 4 |
4 files changed, 23 insertions, 5 deletions
@@ -197,6 +197,9 @@ all of a, b, and d as possible starting code units; now it sets only a and d. 54. Fix incorrect class character matches in JIT. +55. In pcre2test, ensure pcre2_jit_match() is used when jitfast is used with +substitution testing. + Version 10.42 11-December-2022 ------------------------------ diff --git a/src/pcre2test.c b/src/pcre2test.c index c016aa92..8dd06056 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -7513,9 +7513,9 @@ if (dat_datctl.replacement[0] != 0 && (dat_datctl.control & CTL_DFA) != 0) dat_datctl.replacement[0] = 0; } -/* If a replacement string is provided, call pcre2_substitute() instead of one -of the matching functions. First we have to convert the replacement string to -the appropriate width. */ +/* If a replacement string is provided, call pcre2_substitute() instead of or +after one of the matching functions. First we have to convert the replacement +string to the appropriate width. */ if (dat_datctl.replacement[0] != 0) { @@ -7559,8 +7559,16 @@ if (dat_datctl.replacement[0] != 0) if (emoption != 0) { - PCRE2_MATCH(rc, compiled_code, pp, arg_ulen, dat_datctl.offset, - dat_datctl.options, match_data, use_dat_context); + if ((pat_patctl.control & CTL_JITFAST) != 0) + { + PCRE2_JIT_MATCH(rc, compiled_code, pp, arg_ulen, dat_datctl.offset, + dat_datctl.options, match_data, use_dat_context); + } + else + { + PCRE2_MATCH(rc, compiled_code, pp, arg_ulen, dat_datctl.offset, + dat_datctl.options, match_data, use_dat_context); + } } xoptions = emoption | diff --git a/testdata/testinput17 b/testdata/testinput17 index 9c62c391..a0c2761c 100644 --- a/testdata/testinput17 +++ b/testdata/testinput17 @@ -306,5 +306,8 @@ //jit \=null_subject + +/(.)(.)/jitfast,replace=$2+$1 + ABCD # End of testinput17 diff --git a/testdata/testoutput17 b/testdata/testoutput17 index 5d68b0a4..9db205dc 100644 --- a/testdata/testoutput17 +++ b/testdata/testoutput17 @@ -553,5 +553,9 @@ Failed: error -47: match limit exceeded //jit \=null_subject 0: (JIT) + +/(.)(.)/jitfast,replace=$2+$1 + ABCD + 1: B+ACD # End of testinput17 |