Make pcre2grep use JIT (it was omitted by mistake).

This commit is contained in:
Philip.Hazel 2016-05-31 11:06:53 +00:00
parent de605ef9a0
commit 047695ac7c
2 changed files with 20 additions and 2 deletions

View File

@ -118,6 +118,9 @@ that it expects trusted data.
29. Fix typo in pcre2_jit_test.c 29. Fix typo in pcre2_jit_test.c
30. Due to an oversight, pcre2grep was not making use of JIT when available.
This is now fixed.
Version 10.21 12-January-2016 Version 10.21 12-January-2016
----------------------------- -----------------------------

View File

@ -2788,9 +2788,24 @@ if ((popts & PO_FIXED_STRINGS) != 0)
sprintf((char *)buffer, "%s%.*s%s", prefix[popts], patlen, ps, suffix[popts]); sprintf((char *)buffer, "%s%.*s%s", prefix[popts], patlen, ps, suffix[popts]);
p->compiled = pcre2_compile(buffer, -1, options, &errcode, &erroffset, p->compiled = pcre2_compile(buffer, -1, options, &errcode, &erroffset,
compile_context); compile_context);
if (p->compiled != NULL) return TRUE;
/* Handle compile errors */ /* Handle successful compile */
if (p->compiled != NULL)
{
#ifdef SUPPORT_PCRE2GREP_JIT
if (use_jit)
{
errcode = pcre2_jit_compile(p->compiled, PCRE2_JIT_COMPLETE);
if (errcode == 0) return TRUE;
erroffset = PCRE2_SIZE_MAX; /* Will get reduced to patlen below */
}
else
#endif
return TRUE;
}
/* Handle compile and JIT compile errors */
erroffset -= (int)strlen(prefix[popts]); erroffset -= (int)strlen(prefix[popts]);
if (erroffset > patlen) erroffset = patlen; if (erroffset > patlen) erroffset = patlen;