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"