Skip to content

Commit

Permalink
unpackstring: Use bytes_to_utf8_temp_pv
Browse files Browse the repository at this point in the history
This will only malloc if necessary.
  • Loading branch information
khwilliamson committed Jan 29, 2025
1 parent dd06810 commit 87191dc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pp_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,7 @@ Perl_unpackstring(pTHX_ const char *pat, const char *patend, const char *s, cons
/* We probably should try to avoid this in case a scalar context call
wouldn't get to the "U0" */
STRLEN len = strend - s;
s = (char *) bytes_to_utf8((U8 *) s, &len);
SAVEFREEPV(s);
s = (char *) bytes_to_utf8_temp_pv((U8 *) s, &len);
strend = s + len;
flags |= FLAG_DO_UTF8;
}
Expand Down

0 comments on commit 87191dc

Please sign in to comment.