Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find_by_class: Use new utf8_to_uv; not utf8_to_uvchr_buf #22832

Draft
wants to merge 1 commit into
base: blead
Choose a base branch
from
Draft
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
47 changes: 18 additions & 29 deletions regexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
* ('p8' and 'pb'. */
switch (with_tp_UTF8ness(OP(c), utf8_target, is_utf8_pat)) {
SV * anyofh_list;
UV cp; /* scratch */

case ANYOFPOSIXL_t8_pb:
case ANYOFPOSIXL_t8_p8:
Expand Down Expand Up @@ -2398,10 +2399,8 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
anyofh_list = GET_ANYOFH_INVLIST(prog, c);
REXEC_FBC_UTF8_CLASS_SCAN(
( (U8) NATIVE_UTF8_TO_I8(*s) >= ANYOF_FLAGS(c)
&& _invlist_contains_cp(anyofh_list,
utf8_to_uvchr_buf((U8 *) s,
(U8 *) strend,
NULL))));
&& utf8_to_uv((U8 *) s, (U8 *) strend, &cp, NULL)
&& _invlist_contains_cp(anyofh_list, cp)));
break;

case ANYOFHb_t8_pb:
Expand All @@ -2412,10 +2411,8 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,

anyofh_list = GET_ANYOFH_INVLIST(prog, c);
REXEC_FBC_FIND_NEXT_UTF8_BYTE_SCAN(first_byte,
_invlist_contains_cp(anyofh_list,
utf8_to_uvchr_buf((U8 *) s,
(U8 *) strend,
NULL)));
( utf8_to_uv((U8 *) s, (U8 *) strend, &cp, NULL)
&& _invlist_contains_cp(anyofh_list, cp)));
}
break;

Expand All @@ -2440,10 +2437,8 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
( inRANGE(NATIVE_UTF8_TO_I8(*s),
LOWEST_ANYOF_HRx_BYTE(ANYOF_FLAGS(c)),
HIGHEST_ANYOF_HRx_BYTE(ANYOF_FLAGS(c)))
&& _invlist_contains_cp(anyofh_list,
utf8_to_uvchr_buf((U8 *) s,
(U8 *) strend,
NULL))));
&& utf8_to_uv((U8 *) s, (U8 *) strend, &cp, NULL)
&& _invlist_contains_cp(anyofh_list, cp)));
break;

case ANYOFHs_t8_pb:
Expand All @@ -2453,10 +2448,8 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
((struct regnode_anyofhs *) c)->string,
/* Note FLAGS is the string length in this regnode */
((struct regnode_anyofhs *) c)->string + FLAGS(c),
_invlist_contains_cp(anyofh_list,
utf8_to_uvchr_buf((U8 *) s,
(U8 *) strend,
NULL)));
( utf8_to_uv((U8 *) s, (U8 *) strend, &cp, NULL)
&& _invlist_contains_cp(anyofh_list, cp)));
break;

case ANYOFR_tb_pb:
Expand All @@ -2469,10 +2462,8 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
case ANYOFR_t8_p8:
REXEC_FBC_UTF8_CLASS_SCAN(
( NATIVE_UTF8_TO_I8(*s) >= ANYOF_FLAGS(c)
&& withinCOUNT(utf8_to_uvchr_buf((U8 *) s,
(U8 *) strend,
NULL),
ANYOFRbase(c), ANYOFRdelta(c))));
&& utf8_to_uv((U8 *) s, (U8 *) strend, &cp, NULL)
&& withinCOUNT(cp, ANYOFRbase(c), ANYOFRdelta(c))));
break;

case ANYOFRb_tb_pb:
Expand All @@ -2487,10 +2478,8 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
U8 first_byte = FLAGS(c);

REXEC_FBC_FIND_NEXT_UTF8_BYTE_SCAN(first_byte,
withinCOUNT(utf8_to_uvchr_buf((U8 *) s,
(U8 *) strend,
NULL),
ANYOFRbase(c), ANYOFRdelta(c)));
( utf8_to_uv((U8 *) s, (U8 *) strend, &cp, NULL)
&& withinCOUNT(cp, ANYOFRbase(c), ANYOFRdelta(c))));
}
break;

Expand Down Expand Up @@ -3201,11 +3190,11 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
switch (classnum) {
default:
REXEC_FBC_UTF8_CLASS_SCAN(
to_complement ^ cBOOL(_invlist_contains_cp(
PL_XPosix_ptrs[classnum],
utf8_to_uvchr_buf((U8 *) s,
(U8 *) strend,
NULL))));
to_complement ^ cBOOL(
utf8_to_uv((U8 *) s, (U8 *) strend,
&cp, NULL)
&& _invlist_contains_cp(
PL_XPosix_ptrs[classnum], cp)));
break;

case CC_ENUM_SPACE_:
Expand Down
Loading