pcre2/pcre2-10.21-Make-pcre2grep-use-JIT-it-was-omitted-by-mistake.patch
2016-06-03 10:39:09 +02:00

47 lines
1.3 KiB
Diff

From c3e3345d205607532c739b38acbc100623cd512a Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue, 31 May 2016 11:06:53 +0000
Subject: [PATCH] Make pcre2grep use JIT (it was omitted by mistake).
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@519 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.21.
diff --git a/src/pcre2grep.c b/src/pcre2grep.c
index 47d2a4e..60b6812 100644
--- a/src/pcre2grep.c
+++ b/src/pcre2grep.c
@@ -2788,9 +2788,24 @@ if ((popts & PO_FIXED_STRINGS) != 0)
sprintf((char *)buffer, "%s%.*s%s", prefix[popts], patlen, ps, suffix[popts]);
p->compiled = pcre2_compile(buffer, -1, options, &errcode, &erroffset,
compile_context);
-if (p->compiled != NULL) return TRUE;
+
+/* 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 errors */
+/* Handle compile and JIT compile errors */
erroffset -= (int)strlen(prefix[popts]);
if (erroffset > patlen) erroffset = patlen;
--
2.5.5