[Pcre-svn] [519] code/trunk: Make pcre2grep use JIT (it was …

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [519] code/trunk: Make pcre2grep use JIT (it was omitted by mistake).
Revision: 519
          http://www.exim.org/viewvc/pcre2?view=rev&revision=519
Author:   ph10
Date:     2016-05-31 12:06:53 +0100 (Tue, 31 May 2016)
Log Message:
-----------
Make pcre2grep use JIT (it was omitted by mistake).


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2grep.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-05-25 08:42:31 UTC (rev 518)
+++ code/trunk/ChangeLog    2016-05-31 11:06:53 UTC (rev 519)
@@ -118,7 +118,10 @@


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
-----------------------------


Modified: code/trunk/src/pcre2grep.c
===================================================================
--- code/trunk/src/pcre2grep.c    2016-05-25 08:42:31 UTC (rev 518)
+++ code/trunk/src/pcre2grep.c    2016-05-31 11:06:53 UTC (rev 519)
@@ -2788,9 +2788,24 @@
 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;