[Commits] 88ae11c: MDEV-14024 PCRE2

Alexey Botchkov holyfoot at askmonty.org
Mon Apr 2 18:40:35 EEST 2018


revision-id: 88ae11ce385bf3d94b59385f1ef5f8219ffec3fc (mariadb-10.3.5-76-g88ae11c)
parent(s): 6d367b9fb06fe84e252283af4943ed8ee9373483
committer: Alexey Botchkov
timestamp: 2018-04-02 19:35:52 +0400
message:

MDEV-14024 PCRE2

server code changed to use the PCRE2 features.

---
 CMakeLists.txt                    |   2 +-
 client/CMakeLists.txt             |   2 +-
 client/mysqltest.cc               |   2 +-
 cmake/pcre.cmake                  |  21 ++----
 extra/mariabackup/CMakeLists.txt  |   4 +-
 extra/mariabackup/xb_regex.h      |   2 +-
 libmysqld/CMakeLists.txt          |   2 +-
 libmysqld/examples/CMakeLists.txt |   2 +-
 sql/CMakeLists.txt                |   2 +-
 sql/item_cmpfunc.cc               | 152 +++++++++++---------------------------
 sql/item_cmpfunc.h                |  27 ++++---
 sql/mysqld.cc                     |   4 +-
 sql/sys_vars.cc                   |  16 ++--
 storage/mroonga/CMakeLists.txt    |   4 +-
 14 files changed, 88 insertions(+), 154 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0813cf2..b59fb23 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -324,7 +324,7 @@ IF(NOT HAVE_CXX_NEW)
 ENDIF()
 
 # Find header files from the bundled libraries
-# (yassl, readline, pcre, etc)
+# (yassl, readline, pcre2, etc)
 # before the ones installed in the system
 SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
 
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index e0d34b9..02579ca 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -45,7 +45,7 @@ ENDIF(UNIX)
 
 MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
 SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
-TARGET_LINK_LIBRARIES(mysqltest  ${CLIENT_LIB} pcre pcreposix)
+TARGET_LINK_LIBRARIES(mysqltest  ${CLIENT_LIB} pcre2-8 pcre2-posix)
 SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE)
 
 
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index efc25f3..bcabcbb 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -45,7 +45,7 @@
 #include <stdarg.h>
 #include <violite.h>
 #define PCRE_STATIC 1  /* Important on Windows */
-#include "pcreposix.h" /* pcreposix regex library */
+#include "pcre2posix.h" /* pcreposix regex library */
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake
index 4c11392..a70d280 100644
--- a/cmake/pcre.cmake
+++ b/cmake/pcre.cmake
@@ -5,24 +5,15 @@ SET(WITH_PCRE "auto" CACHE STRING
 
 MACRO (CHECK_PCRE)
   IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto")
-    CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE_STACK_GUARD)
-    IF(NOT CMAKE_CROSSCOMPILING)
-      SET(CMAKE_REQUIRED_LIBRARIES "pcre")
-      CHECK_C_SOURCE_RUNS("
-        #include <pcre.h>
-        int main() {
-        return -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) < 256;
-        }"  PCRE_STACK_SIZE_OK)
-      SET(CMAKE_REQUIRED_LIBRARIES)
-    ENDIF()
+    CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match "" HAVE_PCRE2)
   ENDIF()
-  IF(NOT HAVE_PCRE_STACK_GUARD OR NOT PCRE_STACK_SIZE_OK OR
-     WITH_PCRE STREQUAL "bundled")
+  IF(NOT HAVE_PCRE2 OR WITH_PCRE STREQUAL "bundled")
     IF (WITH_PCRE STREQUAL "system")
-      MESSAGE(FATAL_ERROR "system pcre is not found or unusable")
+      MESSAGE(FATAL_ERROR "system pcre2-8 is not found or unusable")
     ENDIF()
-    SET(PCRE_INCLUDES ${CMAKE_BINARY_DIR}/pcre ${CMAKE_SOURCE_DIR}/pcre)
-    ADD_SUBDIRECTORY(pcre)
+    SET(PCRE_INCLUDES ${CMAKE_BINARY_DIR}/pcre2 ${CMAKE_SOURCE_DIR}/pcre2
+                      ${CMAKE_BINARY_DIR}/pcre2/src ${CMAKE_SOURCE_DIR}/pcre2/src)
+    ADD_SUBDIRECTORY(pcre2)
   ENDIF()
 ENDMACRO()
 
diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt
index f92da3f..a787251 100644
--- a/extra/mariabackup/CMakeLists.txt
+++ b/extra/mariabackup/CMakeLists.txt
@@ -37,7 +37,7 @@ INCLUDE_DIRECTORIES(
   )
 
 IF(NOT HAVE_SYSTEM_REGEX)
-  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pcre)
+  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pcre2 ${CMAKE_SOURCE_DIR}/pcre2/src)
 ENDIF()
 
 IF(WITH_WSREP)
@@ -92,7 +92,7 @@ ADD_SUBDIRECTORY(crc)
 TARGET_LINK_LIBRARIES(mariabackup sql crc)
 
 IF(NOT HAVE_SYSTEM_REGEX)
-  TARGET_LINK_LIBRARIES(mariabackup pcreposix)
+  TARGET_LINK_LIBRARIES(mariabackup pcre2-posix)
 ENDIF()
 
 
diff --git a/extra/mariabackup/xb_regex.h b/extra/mariabackup/xb_regex.h
index 2e07e43..6277d04 100644
--- a/extra/mariabackup/xb_regex.h
+++ b/extra/mariabackup/xb_regex.h
@@ -25,7 +25,7 @@ my_regex is used on Windows and native calls are used on POSIX platforms. */
 #ifdef HAVE_SYSTEM_REGEX
 #include <regex.h>
 #else
-#include <pcreposix.h>
+#include <pcre2posix.h>
 #endif
 
 typedef regex_t* xb_regex_t;
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 718e832..29ddc2a 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -145,7 +145,7 @@ ENDIF()
 
 
 SET(LIBS 
-  dbug strings mysys mysys_ssl pcre vio 
+  dbug strings mysys mysys_ssl pcre2-8 vio 
   ${ZLIB_LIBRARY} ${SSL_LIBRARIES} 
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL}
   ${MYSQLD_STATIC_PLUGIN_LIBS}
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index d47638a..c2f7766 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -34,7 +34,7 @@ ENDIF(UNIX)
 
 MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc
   COMPONENT Test)
-TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre pcreposix)
+TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre2-8 pcre2-posix)
 
 IF(CMAKE_GENERATOR MATCHES "Xcode")
 # It does not seem possible to tell Xcode the resulting target might need
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index c7c4df2..6c461a7 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -177,7 +177,7 @@ ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
 ADD_DEPENDENCIES(sql GenServerSource)
 DTRACE_INSTRUMENT(sql)
 TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} 
-  mysys mysys_ssl dbug strings vio pcre
+  mysys mysys_ssl dbug strings vio pcre2-8
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
   ${WSREP_LIB}
   ${SSL_LIBRARIES}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 89aa307..738ac18 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5483,11 +5483,13 @@ int Regexp_processor_pcre::default_regex_flags()
 
 void Regexp_processor_pcre::set_recursion_limit(THD *thd)
 {
+  /*14024
   long stack_used;
   DBUG_ASSERT(thd == current_thd);
   stack_used= available_stack_size(thd->thread_stack, &stack_used);
   m_pcre_extra.match_limit_recursion=
     (ulong)((my_thread_stack_size - STACK_MIN_SIZE - stack_used)/my_pcre_frame_size);
+    */
 }
 
 
@@ -5523,8 +5525,8 @@ String *Regexp_processor_pcre::convert_if_needed(String *str, String *converter)
 
 bool Regexp_processor_pcre::compile(String *pattern, bool send_error)
 {
-  const char *pcreErrorStr;
-  int pcreErrorOffset;
+  int pcreErrorNumber;
+  PCRE2_SIZE pcreErrorOffset;
 
   if (is_compiled())
   {
@@ -5537,19 +5539,32 @@ bool Regexp_processor_pcre::compile(String *pattern, bool send_error)
   if (!(pattern= convert_if_needed(pattern, &pattern_converter)))
     return true;
 
-  m_pcre= pcre_compile(pattern->c_ptr_safe(), m_library_flags,
-                       &pcreErrorStr, &pcreErrorOffset, NULL);
+  m_pcre= pcre2_compile((PCRE2_SPTR8) pattern->ptr(), pattern->length(),
+                        m_library_flags,
+                        &pcreErrorNumber, &pcreErrorOffset, NULL);
 
   if (m_pcre == NULL)
   {
     if (send_error)
     {
       char buff[MAX_FIELD_WIDTH];
-      my_snprintf(buff, sizeof(buff), "%s at offset %d", pcreErrorStr, pcreErrorOffset);
+      int lmsg= pcre2_get_error_message(pcreErrorNumber,
+                                        (PCRE2_UCHAR8 *)buff, sizeof(buff));
+      if (lmsg >= 0)
+        my_snprintf(buff+lmsg, sizeof(buff)-lmsg,
+                    " at offset %d", pcreErrorOffset);
       my_error(ER_REGEXP_ERROR, MYF(0), buff);
     }
     return true;
   }
+
+  m_pcre_match_data= pcre2_match_data_create_from_pattern(m_pcre, NULL);
+  if (m_pcre_match_data == NULL)
+  {
+    my_error(ER_OUT_OF_RESOURCES, MYF(0));
+    return true;
+  }
+
   return false;
 }
 
@@ -5570,124 +5585,43 @@ bool Regexp_processor_pcre::compile(Item *item, bool send_error)
 */
 void Regexp_processor_pcre::pcre_exec_warn(int rc) const
 {
-  char buf[64];
-  const char *errmsg= NULL;
+  PCRE2_UCHAR8 buf[128];
   THD *thd= current_thd;
-
-  /*
-    Make a descriptive message only for those pcre_exec() error codes
-    that can actually happen in MariaDB.
-  */
-  switch (rc)
-  {
-  case PCRE_ERROR_NULL:
-    errmsg= "pcre_exec: null argument passed";
-    break;
-  case PCRE_ERROR_BADOPTION:
-    errmsg= "pcre_exec: bad option";
-    break;
-  case PCRE_ERROR_BADMAGIC:
-    errmsg= "pcre_exec: bad magic - not a compiled regex";
-    break;
-  case PCRE_ERROR_UNKNOWN_OPCODE:
-    errmsg= "pcre_exec: error in compiled regex";
-    break;
-  case PCRE_ERROR_NOMEMORY:
-    errmsg= "pcre_exec: Out of memory";
-    break;
-  case PCRE_ERROR_NOSUBSTRING:
-    errmsg= "pcre_exec: no substring";
-    break;
-  case PCRE_ERROR_MATCHLIMIT:
-    errmsg= "pcre_exec: match limit exceeded";
-    break;
-  case PCRE_ERROR_CALLOUT:
-    errmsg= "pcre_exec: callout error";
-    break;
-  case PCRE_ERROR_BADUTF8:
-    errmsg= "pcre_exec: Invalid utf8 byte sequence in the subject string";
-    break;
-  case PCRE_ERROR_BADUTF8_OFFSET:
-    errmsg= "pcre_exec: Started at invalid location within utf8 byte sequence";
-    break;
-  case PCRE_ERROR_PARTIAL:
-    errmsg= "pcre_exec: partial match";
-    break;
-  case PCRE_ERROR_INTERNAL:
-    errmsg= "pcre_exec: internal error";
-    break;
-  case PCRE_ERROR_BADCOUNT:
-    errmsg= "pcre_exec: ovesize is negative";
-    break;
-  case PCRE_ERROR_RECURSIONLIMIT:
-    my_snprintf(buf, sizeof(buf), "pcre_exec: recursion limit of %ld exceeded",
-                m_pcre_extra.match_limit_recursion);
-    errmsg= buf;
-    break;
-  case PCRE_ERROR_BADNEWLINE:
-    errmsg= "pcre_exec: bad newline options";
-    break;
-  case PCRE_ERROR_BADOFFSET:
-    errmsg= "pcre_exec: start offset negative or greater than string length";
-    break;
-  case PCRE_ERROR_SHORTUTF8:
-    errmsg= "pcre_exec: ended in middle of utf8 sequence";
-    break;
-  case PCRE_ERROR_JIT_STACKLIMIT:
-    errmsg= "pcre_exec: insufficient stack memory for JIT compile";
-    break;
-  case PCRE_ERROR_RECURSELOOP:
-    errmsg= "pcre_exec: Recursion loop detected";
-    break;
-  case PCRE_ERROR_BADMODE:
-    errmsg= "pcre_exec: compiled pattern passed to wrong bit library function";
-    break;
-  case PCRE_ERROR_BADENDIANNESS:
-    errmsg= "pcre_exec: compiled pattern passed to wrong endianness processor";
-    break;
-  case PCRE_ERROR_JIT_BADOPTION:
-    errmsg= "pcre_exec: bad jit option";
-    break;
-  case PCRE_ERROR_BADLENGTH:
-    errmsg= "pcre_exec: negative length";
-    break;
-  default:
-    /*
-      As other error codes should normally not happen,
-      we just report the error code without textual description
-      of the code.
-    */
-    my_snprintf(buf, sizeof(buf), "pcre_exec: Internal error (%d)", rc);
-    errmsg= buf;
-  }
-  push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
-                      ER_REGEXP_ERROR, ER_THD(thd, ER_REGEXP_ERROR), errmsg);
+  int errlen= pcre2_get_error_message(rc, buf, sizeof(buf));
+  if (errlen >= 0)
+    push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+                        ER_REGEXP_ERROR, ER_THD(thd, ER_REGEXP_ERROR), buf);
 }
 
 
 /**
   Call pcre_exec() and send a warning if pcre_exec() returned with an error.
 */
-int Regexp_processor_pcre::pcre_exec_with_warn(const pcre *code,
-                                               const pcre_extra *extra,
+int Regexp_processor_pcre::pcre_exec_with_warn(const pcre2_code *code,
+                                               pcre2_match_data *data,
                                                const char *subject,
                                                int length, int startoffset,
-                                               int options, int *ovector,
-                                               int ovecsize)
+                                               uint options)
 {
-  int rc= pcre_exec(code, extra, subject, length,
-                    startoffset, options, ovector, ovecsize);
+  int rc= pcre2_match(code, (PCRE2_SPTR8) subject, (PCRE2_SIZE) length,
+                      (PCRE2_SIZE) startoffset, options, data, NULL);
   DBUG_EXECUTE_IF("pcre_exec_error_123", rc= -123;);
-  if (rc < PCRE_ERROR_NOMATCH)
+  if (rc < PCRE2_ERROR_NOMATCH)
+  {
     pcre_exec_warn(rc);
+    m_SubStrVec= NULL;
+  }
+  else
+    m_SubStrVec= pcre2_get_ovector_pointer(m_pcre_match_data);
+
   return rc;
 }
 
 
 bool Regexp_processor_pcre::exec(const char *str, size_t length, size_t offset)
 {
-  m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, &m_pcre_extra, str, (int)length, (int)offset, 0,
-                                      m_SubStrVec, array_elements(m_SubStrVec));
+  m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, m_pcre_match_data,
+                                      str, (int)length, (int)offset, 0);
   return false;
 }
 
@@ -5697,14 +5631,12 @@ bool Regexp_processor_pcre::exec(String *str, int offset,
 {
   if (!(str= convert_if_needed(str, &subject_converter)))
     return true;
-  m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, &m_pcre_extra,
-                                      str->c_ptr_safe(), str->length(),
-                                      offset, 0,
-                                      m_SubStrVec, array_elements(m_SubStrVec));
+  m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, m_pcre_match_data,
+                                      str->ptr(), str->length(), offset, 0);
   if (m_pcre_exec_rc > 0)
   {
     uint i;
-    for (i= 0; i < n_result_offsets_to_convert; i++)
+    for (i= 0; i < n_result_offsets_to_convert && i < m_pcre_exec_rc-1; i++)
     {
       /*
         Convert byte offset into character offset.
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 3d11a22..9663ba0 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -25,7 +25,8 @@
 
 #include "item_func.h"             /* Item_int_func, Item_bool_func */
 #define PCRE_STATIC 1             /* Important on Windows */
-#include "pcre.h"                 /* pcre header file */
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include "pcre2.h"                 /* pcre header file */
 #include "item.h"
 
 extern Item_result item_cmp_type(Item_result a,Item_result b);
@@ -2728,8 +2729,8 @@ class Item_func_like :public Item_bool_func2
 
 class Regexp_processor_pcre
 {
-  pcre *m_pcre;
-  pcre_extra m_pcre_extra;
+  pcre2_code *m_pcre;
+  pcre2_match_data *m_pcre_match_data;
   bool m_conversion_is_needed;
   bool m_is_const;
   int m_library_flags;
@@ -2737,24 +2738,28 @@ class Regexp_processor_pcre
   CHARSET_INFO *m_library_charset;
   String m_prev_pattern;
   int m_pcre_exec_rc;
-  int m_SubStrVec[30];
+  PCRE2_SIZE *m_SubStrVec;
   void pcre_exec_warn(int rc) const;
-  int pcre_exec_with_warn(const pcre *code, const pcre_extra *extra,
+  int pcre_exec_with_warn(const pcre2_code *code,
+                          pcre2_match_data *data,
                           const char *subject, int length, int startoffset,
-                          int options, int *ovector, int ovecsize);
+                          uint options);
 public:
   String *convert_if_needed(String *src, String *converter);
   String subject_converter;
   String pattern_converter;
   String replace_converter;
   Regexp_processor_pcre() :
-    m_pcre(NULL), m_conversion_is_needed(true), m_is_const(0),
+    m_pcre(NULL), m_pcre_match_data(NULL),
+    m_conversion_is_needed(true), m_is_const(0),
     m_library_flags(0),
     m_data_charset(&my_charset_utf8_general_ci),
     m_library_charset(&my_charset_utf8_general_ci)
   {
+    /*14024
     m_pcre_extra.flags= PCRE_EXTRA_MATCH_LIMIT_RECURSION;
     m_pcre_extra.match_limit_recursion= 100L;
+    */
   }
   int default_regex_flags();
   void set_recursion_limit(THD *);
@@ -2762,9 +2767,9 @@ class Regexp_processor_pcre
   {
     m_library_flags= default_regex_flags() | extra_flags |
                     (data_charset != &my_charset_bin ?
-                     (PCRE_UTF8 | PCRE_UCP) : 0) |
+                     (PCRE2_UTF | PCRE2_UCP) : 0) |
                     ((data_charset->state &
-                     (MY_CS_BINSORT | MY_CS_CSSORT)) ? 0 : PCRE_CASELESS);
+                     (MY_CS_BINSORT | MY_CS_CSSORT)) ? 0 : PCRE2_CASELESS);
 
     // Convert text data to utf-8.
     m_library_charset= data_charset == &my_charset_bin ?
@@ -2800,11 +2805,13 @@ class Regexp_processor_pcre
   void reset()
   {
     m_pcre= NULL;
+    m_pcre_match_data= NULL;
     m_prev_pattern.length(0);
   }
   void cleanup()
   {
-    pcre_free(m_pcre);
+    pcre2_match_data_free(m_pcre_match_data);
+    pcre2_code_free(m_pcre);
     reset();
   }
   bool is_compiled() const { return m_pcre != NULL; }
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index fe2b9c8..0de1056 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -111,7 +111,7 @@
 #include "sp_rcontext.h"
 #include "sp_cache.h"
 #include "sql_reload.h"  // reload_acl_and_cache
-#include "pcre.h"
+#include "pcre2.h"
 
 #ifdef HAVE_POLL_H
 #include <poll.h>
@@ -3762,6 +3762,7 @@ ulonglong my_pcre_frame_size;
 
 static void init_pcre()
 {
+#ifdef mdev14024
   pcre_malloc= pcre_stack_malloc= my_str_malloc_mysqld;
   pcre_free= pcre_stack_free= my_free;
   pcre_stack_guard= check_enough_stack_size_slow;
@@ -3770,6 +3771,7 @@ static void init_pcre()
   // pcre can underestimate its stack usage. Use a safe value, as in the manual
   set_if_bigger(my_pcre_frame_size, 500);
   my_pcre_frame_size += 16; // Again, safety margin, see the manual
+#endif /*mdev14024*/
 }
 
 
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 524ce97..f2c9205 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -5672,19 +5672,21 @@ static const char *default_regex_flags_names[]=
   "DOTALL",    // (?s)  . matches anything including NL
   "DUPNAMES",  // (?J)  Allow duplicate names for subpatterns
   "EXTENDED",  // (?x)  Ignore white space and # comments
-  "EXTRA",     // (?X)  extra features (e.g. error on unknown escape character)
+  "EXTENDED_MORE",//(?xx)  Ignore white space and # comments inside cheracter
+  "EXTRA",     // means nothing since PCRE2
   "MULTILINE", // (?m)  ^ and $ match newlines within data
   "UNGREEDY",  // (?U)  Invert greediness of quantifiers
   0
 };
 static const int default_regex_flags_to_pcre[]=
 {
-  PCRE_DOTALL,
-  PCRE_DUPNAMES,
-  PCRE_EXTENDED,
-  PCRE_EXTRA,
-  PCRE_MULTILINE,
-  PCRE_UNGREEDY,
+  PCRE2_DOTALL,
+  PCRE2_DUPNAMES,
+  PCRE2_EXTENDED,
+  PCRE2_EXTENDED_MORE,
+  0, /* EXTRA flag not available since PCRE2 */
+  PCRE2_MULTILINE,
+  PCRE2_UNGREEDY,
   0
 };
 int default_regex_flags_pcre(const THD *thd)
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index 5d8e8c1..57d12a1 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -189,8 +189,8 @@ else()
   set(MYSQL_VARIANT "MySQL")
 endif()
 
-if(EXISTS "${MYSQL_SOURCE_DIR}/pcre")
-  set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/pcre")
+if(EXISTS "${MYSQL_SOURCE_DIR}/pcre2")
+  set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/pcre2/src")
 else()
   set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/regex")
 endif()


More information about the commits mailing list