This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[rt #111640] TODO tests for warnings from -X on File::stat
[perl5.git] / universal.c
index 36800b8..b3c7015 100644 (file)
@@ -652,7 +652,13 @@ XS(XS_version_boolean)
     SP -= items;
     if (sv_isobject(ST(0)) && sv_derived_from(ST(0), "version")) {
        SV * const lobj = SvRV(ST(0));
-       SV * const rs = newSViv( vcmp(lobj,new_version(newSVpvs("0"))) );
+       SV * const rs =
+           newSViv( vcmp(lobj,
+                         sv_2mortal(new_version(
+                                       sv_2mortal(newSVpvs("0"))
+                                   ))
+                        )
+                  );
        mPUSHs(rs);
        PUTBACK;
        return;
@@ -812,7 +818,7 @@ XS(XS_utf8_decode)
     else {
        SV * const sv = ST(0);
        bool RETVAL;
-       if (SvIsCOW(sv)) sv_force_normal(sv);
+       SvPV_force_nolen(sv);
        RETVAL = sv_utf8_decode(sv);
        ST(0) = boolSV(RETVAL);
     }
@@ -1006,7 +1012,7 @@ XS(XS_PerlIO_get_layers)
        sv = POPs;
        gv = MAYBE_DEREF_GV(sv);
 
-       if (!gv && SvPOKp(sv))
+       if (!gv && !SvROK(sv))
            gv = gv_fetchsv_nomg(sv, 0, SVt_PVIO);
 
        if (gv && (io = GvIO(gv))) {