Branch: refs/heads/blead Home: https://github.com/Perl/perl5 Commit: d860cbcc8bff61b147ba7479706b0fc735a4a820 https://github.com/Perl/perl5/commit/d860cbcc8bff61b147ba7479706b0fc735a4a820 Author: Richard Leach <richardle...@users.noreply.github.com> Date: 2025-02-10 (Mon, 10 Feb 2025)
Changed paths: M pp.c Log Message: ----------- pp_substr: no temp SV needed to upgrade a replacement string to UTF-8 Currently, when copying the replacement string in preparation for `sv_utf8_upgrade()`, `pp_substr` calls: repl_sv_copy = newSVsv(repl_sv); However, `repl_sv` was previously checked for GMAGIC, coerced to a string if necessary, and the char * and length obtained by: repl = SvPV_const(repl_sv, repl_len); We can instead call `bytes_to_utf8_free_me` on `repl`, which returns: * a pointer into a new, temporary upgraded buffer * `repl` unchanged depending upon whether or not the string representation was changed. Commit: ca9b8c78b2afb734e697654fc6efbdcf3dcecb01 https://github.com/Perl/perl5/commit/ca9b8c78b2afb734e697654fc6efbdcf3dcecb01 Author: Richard Leach <richardle...@users.noreply.github.com> Date: 2025-02-10 (Mon, 10 Feb 2025) Changed paths: M pp.c Log Message: ----------- pp_substr: checking SvOK() is superfluous after SvPV_force_nomg() When replacing some characters in pp_substr, there should be no need to check `SvOK(sv)`, since previous calls to `SvPV_force_nomg(sv)` and (if needed) `sv_utf8_upgrade_nomg(sv);` should always return a `sv` that is `SvOK`. Compare: https://github.com/Perl/perl5/compare/8dad82902c17...ca9b8c78b2af To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications