This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove duplicate $VERSION handling code, made redundant in 3.28_01
[perl5.git] / universal.c
index 145d860..35d1bcc 100644 (file)
@@ -695,9 +695,10 @@ XS(XS_utf8_decode)
        croak_xs_usage(cv, "sv");
     else {
        SV * const sv = ST(0);
-       const bool RETVAL = sv_utf8_decode(sv);
+       bool RETVAL;
+       if (SvIsCOW(sv)) sv_force_normal(sv);
+       RETVAL = sv_utf8_decode(sv);
        ST(0) = boolSV(RETVAL);
-       sv_2mortal(ST(0));
     }
     XSRETURN(1);
 }
@@ -731,7 +732,6 @@ XS(XS_utf8_downgrade)
         const bool RETVAL = sv_utf8_downgrade(sv, failok);
 
        ST(0) = boolSV(RETVAL);
-       sv_2mortal(ST(0));
     }
     XSRETURN(1);
 }