Skip to content

Commit 0495fa0

Browse files
authored
Remove never-implemented UTF-21 mode placeholders
1 parent c07a6e8 commit 0495fa0

File tree

4 files changed

+53
-68
lines changed

4 files changed

+53
-68
lines changed

src/pcre2_dfa_match.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ for (;;)
16011601
goto ANYNL01;
16021602

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

16071607
ANYNL01:
@@ -1879,7 +1879,7 @@ for (;;)
18791879
goto ANYNL02;
18801880

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

18851885
ANYNL02:
@@ -2160,7 +2160,7 @@ for (;;)
21602160
goto ANYNL03;
21612161

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

21662166
ANYNL03:
@@ -2341,7 +2341,7 @@ for (;;)
23412341
if ((mb->moptions & PCRE2_PARTIAL_HARD) != 0)
23422342
reset_could_continue = TRUE;
23432343
}
2344-
else if (UCHAR21TEST(ptr + 1) == CHAR_LF)
2344+
else if (ptr[1] == CHAR_LF)
23452345
{
23462346
ADD_NEW_DATA(-(state_offset + 1), 0, 1);
23472347
}
@@ -3745,7 +3745,7 @@ for (;;)
37453745
BOOL ok = start_match < end_subject;
37463746
if (ok)
37473747
{
3748-
PCRE2_UCHAR c = UCHAR21TEST(start_match);
3748+
PCRE2_UCHAR c = *start_match;
37493749
ok = has_first_cu && (c == first_cu || c == first_cu2);
37503750
if (!ok && start_bits != NULL)
37513751
{
@@ -3773,7 +3773,7 @@ for (;;)
37733773
#if PCRE2_CODE_UNIT_WIDTH != 8
37743774
PCRE2_UCHAR smc;
37753775
while (start_match < end_subject &&
3776-
(smc = UCHAR21TEST(start_match)) != first_cu &&
3776+
(smc = *start_match) != first_cu &&
37773777
smc != first_cu2)
37783778
start_match++;
37793779
#else
@@ -3833,7 +3833,7 @@ for (;;)
38333833
else
38343834
{
38353835
#if PCRE2_CODE_UNIT_WIDTH != 8
3836-
while (start_match < end_subject && UCHAR21TEST(start_match) !=
3836+
while (start_match < end_subject && *start_match !=
38373837
first_cu)
38383838
start_match++;
38393839
#else /* 8-bit code units */
@@ -3885,7 +3885,7 @@ for (;;)
38853885
if (start_match[-1] == CHAR_CR &&
38863886
(mb->nltype == NLTYPE_ANY || mb->nltype == NLTYPE_ANYCRLF) &&
38873887
start_match < end_subject &&
3888-
UCHAR21TEST(start_match) == CHAR_NL)
3888+
*start_match == CHAR_NL)
38893889
start_match++;
38903890
}
38913891
}
@@ -3899,7 +3899,7 @@ for (;;)
38993899
{
39003900
while (start_match < end_subject)
39013901
{
3902-
uint32_t c = UCHAR21TEST(start_match);
3902+
uint32_t c = *start_match;
39033903
#if PCRE2_CODE_UNIT_WIDTH != 8
39043904
if (c > 255) c = 255;
39053905
#endif
@@ -3967,7 +3967,7 @@ for (;;)
39673967
#if PCRE2_CODE_UNIT_WIDTH != 8
39683968
while (p < end_subject)
39693969
{
3970-
uint32_t pp = UCHAR21INCTEST(p);
3970+
uint32_t pp = *p++;
39713971
if (pp == req_cu || pp == req_cu2) { p--; break; }
39723972
}
39733973
#else /* 8-bit code units */
@@ -3988,7 +3988,7 @@ for (;;)
39883988
#if PCRE2_CODE_UNIT_WIDTH != 8
39893989
while (p < end_subject)
39903990
{
3991-
if (UCHAR21INCTEST(p) == req_cu) { p--; break; }
3991+
if (*p++ == req_cu) { p--; break; }
39923992
}
39933993

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

4099-
if (UCHAR21TEST(start_match - 1) == CHAR_CR &&
4099+
if (start_match[-1] == CHAR_CR &&
41004100
start_match < end_subject &&
4101-
UCHAR21TEST(start_match) == CHAR_NL &&
4101+
*start_match == CHAR_NL &&
41024102
(re->flags & PCRE2_HASCRORLF) == 0 &&
41034103
(mb->nltype == NLTYPE_ANY ||
41044104
mb->nltype == NLTYPE_ANYCRLF ||

src/pcre2_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ start/end of string field names are. */
477477
&(NLBLOCK->nllen), utf)) \
478478
: \
479479
((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \
480-
UCHAR21TEST(p) == NLBLOCK->nl[0] && \
481-
(NLBLOCK->nllen == 1 || UCHAR21TEST(p+1) == NLBLOCK->nl[1]) \
480+
*p == NLBLOCK->nl[0] && \
481+
(NLBLOCK->nllen == 1 || p[1] == NLBLOCK->nl[1]) \
482482
) \
483483
)
484484

@@ -491,8 +491,8 @@ start/end of string field names are. */
491491
&(NLBLOCK->nllen), utf)) \
492492
: \
493493
((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \
494-
UCHAR21TEST(p - NLBLOCK->nllen) == NLBLOCK->nl[0] && \
495-
(NLBLOCK->nllen == 1 || UCHAR21TEST(p - NLBLOCK->nllen + 1) == NLBLOCK->nl[1]) \
494+
*(p - NLBLOCK->nllen) == NLBLOCK->nl[0] && \
495+
(NLBLOCK->nllen == 1 || *(p - NLBLOCK->nllen + 1) == NLBLOCK->nl[1]) \
496496
) \
497497
)
498498

src/pcre2_intmodedep.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,6 @@ check is needed before accessing these tables. */
250250

251251
/* ----------------- Character-handling macros ----------------- */
252252

253-
/* There is a proposed future special "UTF-21" mode, in which only the lowest
254-
21 bits of a 32-bit character are interpreted as UTF, with the remaining 11
255-
high-order bits available to the application for other uses. In preparation for
256-
the future implementation of this mode, there are macros that load a data item
257-
and, if in this special mode, mask it to 21 bits. These macros all have names
258-
starting with UCHAR21. In all other modes, including the normal 32-bit
259-
library, the macros all have the same simple definitions. When the new mode is
260-
implemented, it is expected that these definitions will be varied appropriately
261-
using #ifdef when compiling the library that supports the special mode. */
262-
263-
#define UCHAR21(eptr) (*(eptr))
264-
#define UCHAR21TEST(eptr) (*(eptr))
265-
#define UCHAR21INC(eptr) (*(eptr)++)
266-
#define UCHAR21INCTEST(eptr) (*(eptr)++)
267-
268253
/* When UTF encoding is being used, a character is no longer just a single
269254
byte in 8-bit mode or a single short in 16-bit mode. The macros for character
270255
handling generate simple sequences when used in the basic mode, and more

0 commit comments

Comments
 (0)