The old COW code needs to use SvPVX_mutable when doing copy-on-write.
[p5sagit/p5-mst-13.2.git] / universal.c
index 6c118b7..8f706cb 100644 (file)
@@ -254,7 +254,6 @@ XS(XS_UNIVERSAL_isa)
     dXSARGS;
     SV *sv;
     const char *name;
-    STRLEN n_a;
 
     if (items != 2)
        Perl_croak(aTHX_ "Usage: UNIVERSAL::isa(reference, kind)");
@@ -268,7 +267,7 @@ XS(XS_UNIVERSAL_isa)
                || (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv))))
        XSRETURN_UNDEF;
 
-    name = (const char *)SvPV(ST(1),n_a);
+    name = SvPV_nolen_const(ST(1));
 
     ST(0) = boolSV(sv_derived_from(sv, name));
     XSRETURN(1);
@@ -281,7 +280,6 @@ XS(XS_UNIVERSAL_can)
     const char *name;
     SV   *rv;
     HV   *pkg = NULL;
-    STRLEN n_a;
 
     if (items != 2)
        Perl_croak(aTHX_ "Usage: UNIVERSAL::can(object-ref, method)");
@@ -295,7 +293,7 @@ XS(XS_UNIVERSAL_can)
                || (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv))))
        XSRETURN_UNDEF;
 
-    name = (const char *)SvPV(ST(1),n_a);
+    name = SvPV_nolen_const(ST(1));
     rv = &PL_sv_undef;
 
     if (SvROK(sv)) {
@@ -361,10 +359,9 @@ XS(XS_UNIVERSAL_VERSION)
                           "%s does not define $%s::VERSION--version check failed",
                           name, name);
            } else {
-               STRLEN n_a;
                Perl_croak(aTHX_
                             "%s defines neither package nor VERSION--version check failed",
-                            SvPVx(ST(0),n_a) );
+                            SvPVx_nolen_const(ST(0)) );
             }
        }
 
@@ -642,7 +639,7 @@ XS(XS_utf8_valid)
          SV *  sv = ST(0);
          {
               STRLEN len;
-              const char *s = SvPV(sv,len);
+              const char *s = SvPV_const(sv,len);
               if (!SvUTF8(sv) || is_utf8_string((const U8*)s,len))
                    XSRETURN_YES;
               else
@@ -810,7 +807,7 @@ XS(XS_PerlIO_get_layers)
                  SV **varp = svp;
                  SV **valp = svp + 1;
                  STRLEN klen;
-                  const char *key = SvPV(*varp, klen);
+                  const char *key = SvPV_const(*varp, klen);
 
                  switch (*key) {
                  case 'i':