summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pcre_compile.c10
-rw-r--r--pcre_internal.h16
-rw-r--r--pcre_jit_compile.c38
-rw-r--r--pcre_study.c6
4 files changed, 34 insertions, 36 deletions
diff --git a/pcre_compile.c b/pcre_compile.c
index 2949713..1cd5b2d 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -1854,7 +1854,7 @@ for (;;)
case OP_NOTI:
branchlength++;
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -1868,7 +1868,7 @@ for (;;)
case OP_NOTEXACTI:
branchlength += (int)GET2(cc,1);
cc += 2 + IMM2_SIZE;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -4115,7 +4115,7 @@ for (;; ptr++)
{
const pcre_uchar *oldptr;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(c))
{ /* Braces are required because the */
GETCHARLEN(c, ptr, ptr); /* macro generates multiple statements */
@@ -5505,7 +5505,7 @@ for (;; ptr++)
else if (*tempcode == OP_EXACT || *tempcode == OP_NOTEXACT)
{
tempcode += PRIV(OP_lengths)[*tempcode];
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(tempcode[-1]))
tempcode += GET_EXTRALEN(tempcode[-1]);
#endif
@@ -6949,7 +6949,7 @@ for (;; ptr++)
mclength = 1;
mcbuffer[0] = c;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(c))
ACROSSCHAR(TRUE, ptr[1], mcbuffer[mclength++] = *(++ptr));
#endif
diff --git a/pcre_internal.h b/pcre_internal.h
index 1114eaa..1407b78 100644
--- a/pcre_internal.h
+++ b/pcre_internal.h
@@ -914,13 +914,14 @@ code. */
#elif defined COMPILE_PCRE32
-/* These are unnecessary for the 32-bit library */
-#undef MAX_VALUE_FOR_SINGLE_CHAR
-#undef HAS_EXTRALEN
-#undef GET_EXTRALEN
-#undef NOT_FIRSTCHAR
+/* These are trivial for the 32-bit library, since all UTF-32 characters fit
+into one pcre_uchar unit. */
+#define MAX_VALUE_FOR_SINGLE_CHAR (0x10ffffu)
+#define HAS_EXTRALEN(c) (0)
+#define GET_EXTRALEN(c) (0)
+#define NOT_FIRSTCHAR(c) (0)
-#define UTF32_MASK (0x1ffffful)
+#define UTF32_MASK (0x1fffffu)
/* Get the next UTF-32 character, not advancing the pointer. This is called when
we know we are in UTF-32 mode. */
@@ -989,7 +990,8 @@ pointer. */
/* If the pointer is not at the start of a character, move it back until
it is. This is called only in UTF-32 mode - we don't put a test within the
macro because almost all calls are already within a block of UTF-32 only
-code. */
+code.
+These are all no-ops since all UTF-32 characters fit into one pcre_uchar. */
#define BACKCHAR(eptr) do { } while (0)
diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c
index 8b7d289..0e98970 100644
--- a/pcre_jit_compile.c
+++ b/pcre_jit_compile.c
@@ -591,7 +591,7 @@ switch(*cc)
case OP_NOTPOSPLUSI:
case OP_NOTPOSQUERYI:
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
return cc;
@@ -613,7 +613,7 @@ switch(*cc)
case OP_NOTEXACTI:
case OP_NOTPOSUPTOI:
cc += 2 + IMM2_SIZE;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
return cc;
@@ -936,7 +936,7 @@ while (cc < ccend)
if (size < 0)
{
cc += -size;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
}
@@ -1076,7 +1076,7 @@ while (cc < ccend)
if (size < 0)
{
cc += -size;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
}
@@ -1320,7 +1320,7 @@ while (cc < ccend)
if (PRIVATE_DATA(cc))
private_data_length++;
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -1329,7 +1329,7 @@ while (cc < ccend)
if (PRIVATE_DATA(cc))
private_data_length += 2;
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -1338,7 +1338,7 @@ while (cc < ccend)
if (PRIVATE_DATA(cc))
private_data_length += 2;
cc += 2 + IMM2_SIZE;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -1497,7 +1497,7 @@ while (status != end)
srcw[0] = PRIVATE_DATA(cc);
}
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -1510,7 +1510,7 @@ while (status != end)
srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_w);
}
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -1523,7 +1523,7 @@ while (status != end)
srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_w);
}
cc += 2 + IMM2_SIZE;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -2643,7 +2643,7 @@ while (TRUE)
break;
len = 1;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[0])) len += GET_EXTRALEN(cc[0]);
#endif
@@ -3563,10 +3563,8 @@ if (context->sourcereg == -1)
#ifdef SUPPORT_UTF
utflength = 1;
-#ifndef COMPILE_PCRE32
if (common->utf && HAS_EXTRALEN(*cc))
utflength += GET_EXTRALEN(*cc);
-#endif
do
{
@@ -3759,7 +3757,7 @@ while (*cc != XCL_END)
if (*cc == XCL_SINGLE)
{
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
#ifdef SUPPORT_UCP
@@ -3769,11 +3767,11 @@ while (*cc != XCL_END)
else if (*cc == XCL_RANGE)
{
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
cc++;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
#ifdef SUPPORT_UCP
@@ -4467,7 +4465,7 @@ switch(type)
case OP_CHAR:
case OP_CHARI:
length = 1;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(*cc)) length += GET_EXTRALEN(*cc);
#endif
if (common->mode == JIT_COMPILE && (type == OP_CHAR || !char_has_othercase(common, cc) || char_get_othercase_bit(common, cc) != 0))
@@ -4662,7 +4660,7 @@ do
if (*cc == OP_CHAR)
{
size = 1;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(cc[1]))
size += GET_EXTRALEN(cc[1]);
#endif
@@ -4675,10 +4673,8 @@ do
{
if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)
size = 0;
-#ifndef COMPILE_PCRE32
else if (HAS_EXTRALEN(cc[1]))
size += GET_EXTRALEN(cc[1]);
-#endif
}
else
#endif
@@ -6266,7 +6262,7 @@ if (*type == 0)
if (end != NULL)
{
*end = cc + 1;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (common->utf && HAS_EXTRALEN(*cc)) *end += GET_EXTRALEN(*cc);
#endif
}
diff --git a/pcre_study.c b/pcre_study.c
index 4a68276..5d2680f 100644
--- a/pcre_study.c
+++ b/pcre_study.c
@@ -224,7 +224,7 @@ for (;;)
case OP_NOTPOSPLUSI:
branchlength++;
cc += 2;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -245,7 +245,7 @@ for (;;)
case OP_NOTEXACTI:
branchlength += GET2(cc,1);
cc += 2 + IMM2_SIZE;
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
@@ -486,7 +486,7 @@ for (;;)
case OP_NOTPOSQUERYI:
cc += PRIV(OP_lengths)[op];
-#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;