Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/pcre2_dfa_match.c
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ for (;;)
goto ANYNL01;

case CHAR_CR:
if (ptr + 1 < end_subject && UCHAR21TEST(ptr + 1) == CHAR_LF) ncount = 1;
if (ptr + 1 < end_subject && ptr[1] == CHAR_LF) ncount = 1;
/* Fall through */

ANYNL01:
Expand Down Expand Up @@ -1879,7 +1879,7 @@ for (;;)
goto ANYNL02;

case CHAR_CR:
if (ptr + 1 < end_subject && UCHAR21TEST(ptr + 1) == CHAR_LF) ncount = 1;
if (ptr + 1 < end_subject && ptr[1] == CHAR_LF) ncount = 1;
/* Fall through */

ANYNL02:
Expand Down Expand Up @@ -2160,7 +2160,7 @@ for (;;)
goto ANYNL03;

case CHAR_CR:
if (ptr + 1 < end_subject && UCHAR21TEST(ptr + 1) == CHAR_LF) ncount = 1;
if (ptr + 1 < end_subject && ptr[1] == CHAR_LF) ncount = 1;
/* Fall through */

ANYNL03:
Expand Down Expand Up @@ -2341,7 +2341,7 @@ for (;;)
if ((mb->moptions & PCRE2_PARTIAL_HARD) != 0)
reset_could_continue = TRUE;
}
else if (UCHAR21TEST(ptr + 1) == CHAR_LF)
else if (ptr[1] == CHAR_LF)
{
ADD_NEW_DATA(-(state_offset + 1), 0, 1);
}
Expand Down Expand Up @@ -3745,7 +3745,7 @@ for (;;)
BOOL ok = start_match < end_subject;
if (ok)
{
PCRE2_UCHAR c = UCHAR21TEST(start_match);
PCRE2_UCHAR c = *start_match;
ok = has_first_cu && (c == first_cu || c == first_cu2);
if (!ok && start_bits != NULL)
{
Expand Down Expand Up @@ -3773,7 +3773,7 @@ for (;;)
#if PCRE2_CODE_UNIT_WIDTH != 8
PCRE2_UCHAR smc;
while (start_match < end_subject &&
(smc = UCHAR21TEST(start_match)) != first_cu &&
(smc = *start_match) != first_cu &&
smc != first_cu2)
start_match++;
#else
Expand Down Expand Up @@ -3833,7 +3833,7 @@ for (;;)
else
{
#if PCRE2_CODE_UNIT_WIDTH != 8
while (start_match < end_subject && UCHAR21TEST(start_match) !=
while (start_match < end_subject && *start_match !=
first_cu)
start_match++;
#else /* 8-bit code units */
Expand Down Expand Up @@ -3885,7 +3885,7 @@ for (;;)
if (start_match[-1] == CHAR_CR &&
(mb->nltype == NLTYPE_ANY || mb->nltype == NLTYPE_ANYCRLF) &&
start_match < end_subject &&
UCHAR21TEST(start_match) == CHAR_NL)
*start_match == CHAR_NL)
start_match++;
}
}
Expand All @@ -3899,7 +3899,7 @@ for (;;)
{
while (start_match < end_subject)
{
uint32_t c = UCHAR21TEST(start_match);
uint32_t c = *start_match;
#if PCRE2_CODE_UNIT_WIDTH != 8
if (c > 255) c = 255;
#endif
Expand Down Expand Up @@ -3967,7 +3967,7 @@ for (;;)
#if PCRE2_CODE_UNIT_WIDTH != 8
while (p < end_subject)
{
uint32_t pp = UCHAR21INCTEST(p);
uint32_t pp = *p++;
if (pp == req_cu || pp == req_cu2) { p--; break; }
}
#else /* 8-bit code units */
Expand All @@ -3988,7 +3988,7 @@ for (;;)
#if PCRE2_CODE_UNIT_WIDTH != 8
while (p < end_subject)
{
if (UCHAR21INCTEST(p) == req_cu) { p--; break; }
if (*p++ == req_cu) { p--; break; }
}

#else /* 8-bit code units */
Expand Down Expand Up @@ -4096,9 +4096,9 @@ for (;;)
not contain any explicit matches for \r or \n, and the newline option is CRLF
or ANY or ANYCRLF, advance the match position by one more character. */

if (UCHAR21TEST(start_match - 1) == CHAR_CR &&
if (start_match[-1] == CHAR_CR &&
start_match < end_subject &&
UCHAR21TEST(start_match) == CHAR_NL &&
*start_match == CHAR_NL &&
(re->flags & PCRE2_HASCRORLF) == 0 &&
(mb->nltype == NLTYPE_ANY ||
mb->nltype == NLTYPE_ANYCRLF ||
Expand Down
8 changes: 4 additions & 4 deletions src/pcre2_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,8 @@ start/end of string field names are. */
&(NLBLOCK->nllen), utf)) \
: \
((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \
UCHAR21TEST(p) == NLBLOCK->nl[0] && \
(NLBLOCK->nllen == 1 || UCHAR21TEST(p+1) == NLBLOCK->nl[1]) \
*p == NLBLOCK->nl[0] && \
(NLBLOCK->nllen == 1 || p[1] == NLBLOCK->nl[1]) \
) \
)

Expand All @@ -491,8 +491,8 @@ start/end of string field names are. */
&(NLBLOCK->nllen), utf)) \
: \
((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \
UCHAR21TEST(p - NLBLOCK->nllen) == NLBLOCK->nl[0] && \
(NLBLOCK->nllen == 1 || UCHAR21TEST(p - NLBLOCK->nllen + 1) == NLBLOCK->nl[1]) \
*(p - NLBLOCK->nllen) == NLBLOCK->nl[0] && \
(NLBLOCK->nllen == 1 || *(p - NLBLOCK->nllen + 1) == NLBLOCK->nl[1]) \
) \
)

Expand Down
15 changes: 0 additions & 15 deletions src/pcre2_intmodedep.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,21 +250,6 @@ check is needed before accessing these tables. */

/* ----------------- Character-handling macros ----------------- */

/* There is a proposed future special "UTF-21" mode, in which only the lowest
21 bits of a 32-bit character are interpreted as UTF, with the remaining 11
high-order bits available to the application for other uses. In preparation for
the future implementation of this mode, there are macros that load a data item
and, if in this special mode, mask it to 21 bits. These macros all have names
starting with UCHAR21. In all other modes, including the normal 32-bit
library, the macros all have the same simple definitions. When the new mode is
implemented, it is expected that these definitions will be varied appropriately
using #ifdef when compiling the library that supports the special mode. */

#define UCHAR21(eptr) (*(eptr))
#define UCHAR21TEST(eptr) (*(eptr))
#define UCHAR21INC(eptr) (*(eptr)++)
#define UCHAR21INCTEST(eptr) (*(eptr)++)

/* When UTF encoding is being used, a character is no longer just a single
byte in 8-bit mode or a single short in 16-bit mode. The macros for character
handling generate simple sequences when used in the basic mode, and more
Expand Down
Loading