Skip to content

Commit 76e7955

Browse files
committed
do_vop: Use utf8_to_bytes_temp_pv
This simplifies the code
1 parent 34e58a7 commit 76e7955

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

doop.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,22 +1021,12 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
10211021
/* Create downgraded temporaries of any UTF-8 encoded operands. As of
10221022
* perl-5.32, we no longer accept above-FF code points at all */
10231023
if (DO_UTF8(left)) {
1024-
left_utf8 = TRUE;
10251024
result_needs_to_be_utf8 = TRUE;
1026-
1027-
lc = (char *) bytes_from_utf8((const U8 *) lc, &leftlen, &left_utf8);
1028-
if (! left_utf8) {
1029-
SAVEFREEPV(lc);
1030-
}
1025+
left_utf8 = ! utf8_to_bytes_temp_pv((const U8 **) &lc, &leftlen);
10311026
}
10321027
if (DO_UTF8(right)) {
1033-
right_utf8 = TRUE;
10341028
result_needs_to_be_utf8 = TRUE;
1035-
1036-
rc = (char *) bytes_from_utf8((const U8 *) rc, &rightlen, &right_utf8);
1037-
if (! right_utf8) {
1038-
SAVEFREEPV(rc);
1039-
}
1029+
right_utf8 = ! utf8_to_bytes_temp_pv((const U8 **) &rc, &rightlen);
10401030
}
10411031

10421032
/* We set 'len' to the length that the operation actually operates on. The

0 commit comments

Comments
 (0)