Skip to content

Commit

Permalink
do_vop: Use utf8_to_bytes_temp_pv
Browse files Browse the repository at this point in the history
This simplifies the code
  • Loading branch information
khwilliamson committed Jan 28, 2025
1 parent 34e58a7 commit c0e128e
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions doop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,22 +1021,12 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
/* Create downgraded temporaries of any UTF-8 encoded operands. As of
* perl-5.32, we no longer accept above-FF code points at all */
if (DO_UTF8(left)) {
left_utf8 = TRUE;
result_needs_to_be_utf8 = TRUE;

lc = (char *) bytes_from_utf8((const U8 *) lc, &leftlen, &left_utf8);
if (! left_utf8) {
SAVEFREEPV(lc);
}
left_utf8 = ! utf8_to_bytes_temp_pv((const U8 **) &lc, &leftlen);
}
if (DO_UTF8(right)) {
right_utf8 = TRUE;
result_needs_to_be_utf8 = TRUE;

rc = (char *) bytes_from_utf8((const U8 *) rc, &rightlen, &right_utf8);
if (! right_utf8) {
SAVEFREEPV(rc);
}
right_utf8 = ! utf8_to_bytes_temp_pv((const U8 **) &rc, &rightlen);
}

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

0 comments on commit c0e128e

Please sign in to comment.