From 7740e825a683a9cc84f8422c94109c5fcc4beb8e Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 17 Aug 2024 22:26:29 +0900 Subject: kjs: use libpcre2 instead of libpcre Signed-off-by: Michele Calgaro --- kjs/regexp.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'kjs/regexp.h') diff --git a/kjs/regexp.h b/kjs/regexp.h index 88851260e..e731eb714 100644 --- a/kjs/regexp.h +++ b/kjs/regexp.h @@ -25,13 +25,16 @@ #include "config.h" -#ifdef HAVE_PCREPOSIX -#include +#ifdef HAVE_PCRE2POSIX +#define PCRE2_CODE_UNIT_WIDTH 8 +#include +typedef PCRE2_UCHAR8 buftype_t; #else // POSIX regex - not so good... extern "C" { // bug with some libc5 distributions #include +typedef char buftype_t; } -#endif //HAVE_PCREPOSIX +#endif #include "ustring.h" @@ -61,7 +64,7 @@ namespace KJS { bool valid; // Cached encoding info... - char* buffer; + buftype_t *buffer; int* originalPos; int bufferSize; @@ -71,22 +74,20 @@ namespace KJS { UString originalS; // the original string, used for sanity-checking #endif -#ifndef HAVE_PCREPOSIX +#ifndef HAVE_PCRE2POSIX regex_t preg; #else - pcre *pcregex; + pcre2_code *pcregex; + pcre2_match_data *match_data; enum UTF8SupportState { Unknown, Supported, Unsupported }; - -#ifdef PCRE_CONFIG_UTF8 static UTF8SupportState utf8Support; #endif -#endif - unsigned int nrSubPatterns; + uint32_t nrSubPatterns; RegExp(); }; -- cgit v1.2.3