Fix build with PCRE2 disabled

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
master
Alexander Golubev 3 days ago committed by Fat-Zer
parent 57a94cb6f5
commit 351e6ce3b2

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

@ -21,6 +21,7 @@
#ifndef _KJS_REGEXP_H_
#define _KJS_REGEXP_H_
#include <stdint.h>
#include <sys/types.h>
#include "config.h"

Loading…
Cancel
Save