From 351e6ce3b2757c57071ab33fdde2afe265c048af Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Sun, 10 Aug 2025 14:40:54 +0300 Subject: [PATCH] Fix build with PCRE2 disabled Signed-off-by: Alexander Golubev --- kjs/regexp.cpp | 6 ++++++ kjs/regexp.h | 1 + 2 files changed, 7 insertions(+) diff --git a/kjs/regexp.cpp b/kjs/regexp.cpp index c92a69d6a..04159904f 100644 --- a/kjs/regexp.cpp +++ b/kjs/regexp.cpp @@ -30,17 +30,21 @@ using namespace KJS; +#ifdef HAVE_PCRE2POSIX RegExp::UTF8SupportState RegExp::utf8Support = RegExp::Unknown; +#endif RegExp::RegExp(const UString &p, int f) : pat(p), flgs(f), m_notEmpty(false), valid(true), buffer(0), originalPos(0) { +#ifdef HAVE_PCRE2POSIX // Determine whether libpcre has unicode support if need be.. if (utf8Support == Unknown) { uint32_t supported; pcre2_config(PCRE2_CONFIG_COMPILED_WIDTHS, (void*)&supported); utf8Support = (supported & 0x0001) ? Supported : Unsupported; } +#endif nrSubPatterns = 0; // determined in match() with POSIX regex. @@ -276,9 +280,11 @@ void RegExp::prepareMatch(const UString &s) { delete[] originalPos; // Just to be sure.. delete[] buffer; +#ifdef HAVE_PCRE2POSIX if (utf8Support == Supported) prepareUtf8(s); else +#endif prepareASCII(s); #ifndef NDEBUG diff --git a/kjs/regexp.h b/kjs/regexp.h index e731eb714..d84fca17c 100644 --- a/kjs/regexp.h +++ b/kjs/regexp.h @@ -21,6 +21,7 @@ #ifndef _KJS_REGEXP_H_ #define _KJS_REGEXP_H_ +#include #include #include "config.h"