This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fixup Perl_magic_freemglob()
[perl5.git] / vxs.inc
diff --git a/vxs.inc b/vxs.inc
index cea9857..80bb8eb 100644 (file)
--- a/vxs.inc
+++ b/vxs.inc
@@ -133,18 +133,13 @@ VXS(universal_version)
        if (undef) {
            if (pkg) {
                const HVNAME* const name = HvNAME_HEK(pkg);
-#if PERL_VERSION == 5
-               Perl_croak(aTHX_ "%s version %s required--this is only version ",
-                           name, SvPVx_nolen_const(req));
-#else
                Perl_croak(aTHX_
                           "%" HEKf " does not define $%" HEKf
                           "::VERSION--version check failed",
                           HEKfARG(name), HEKfARG(name));
-#endif
            }
            else {
-#if PERL_VERSION >= 8
+#if PERL_VERSION_GE(5,8,0)
                Perl_croak(aTHX_
                             "%" SVf " defines neither package nor VERSION--"
                              "version check failed",
@@ -206,11 +201,7 @@ VXS(version_new)
         SV * svarg2;
         vs = sv_newmortal();
         svarg2 = ST(2);
-#if PERL_VERSION == 5
-        sv_setpvf(vs,"v%s",SvPV_nolen_const(svarg2));
-#else
         Perl_sv_setpvf(aTHX_ vs,"v%s",SvPV_nolen_const(svarg2));
-#endif
         break;
     }
     case 2:
@@ -249,11 +240,7 @@ VXS(version_new)
     rv = NEW_VERSION(vs);
     if ( len != sizeof(VXS_CLASS)-1
       || strcmp(classname,VXS_CLASS) != 0 ) /* inherited new() */
-#if PERL_VERSION == 5
-        sv_bless(rv, gv_stashpv((char *)classname, GV_ADD));
-#else
         sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags));
-#endif
 
     VXS_RETURN_M_SV(rv);
 }
@@ -312,8 +299,8 @@ VXS(version_normal)
 VXS(version_vcmp)
 {
      dXSARGS;
-     if (items < 1)
-        croak_xs_usage(cv, "lobj, ...");
+     if (items < 2)
+        croak_xs_usage(cv, "lobj, robj, ...");
      SP -= items;
      {
          SV *  lobj;
@@ -322,7 +309,7 @@ VXS(version_vcmp)
               SV       *rs;
               SV       *rvs;
               SV * robj = ST(1);
-              const IV  swap = (IV)SvIV(ST(2));
+              const int swap = items > 2 ? SvTRUE(ST(2)) : 0;
 
               if ( !ISA_VERSION_OBJ(robj) )
               {
@@ -445,11 +432,7 @@ VXS(version_qv)
        }
        if ( items == 2 && (len != 7
                 || strcmp(classname,"version")) ) { /* inherited new() */
-#if PERL_VERSION == 5
-           sv_bless(rv, gv_stashpv((char *)classname, GV_ADD));
-#else
            sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags));
-#endif
         }
        PUSHs(rv);
     }