summaryrefslogtreecommitdiff
path: root/vxs.inc
diff options
context:
space:
mode:
authorTodd Rinaldo <toddr@cpan.org>2020-10-01 12:01:44 -0500
committerTodd Rinaldo <toddr@cpan.org>2020-10-02 09:50:04 -0500
commit966a34475a7c626a373d46daf542d053d035ed13 (patch)
treef46d9a3cd994ba421595a67e7f7991c663fd805d /vxs.inc
parent04b729c025ff8e603d17d10088b5379837ec644e (diff)
downloadperl-966a34475a7c626a373d46daf542d053d035ed13.tar.gz
Update version to CPAN version 0.9928
[DELTA] 0.9927 * Released 0.99_26 as 0.9927 0.99_26 * Add usage error to pure-perl vcmp * Quote version classname in test for 5.8 compatability * Use base instead of parent for tests * Update ppport.h for future compatibility 0.99_25 * Fix stack usage in vcmp method * Drop Perl 5.5 compatibility * Use PERL_VERSION_GE for Perl 7 compatibility * Fix typo in pod example for comparing versions.
Diffstat (limited to 'vxs.inc')
-rw-r--r--vxs.inc27
1 files changed, 5 insertions, 22 deletions
diff --git a/vxs.inc b/vxs.inc
index cea9857887..1a777d9898 100644
--- a/vxs.inc
+++ b/vxs.inc
@@ -5,7 +5,7 @@
# define VXS_CLASS "version"
# define VXSp(name) XS_##name
/* VXSXSDP = XSUB Details Proto */
-# define VXSXSDP(x) x, 0
+# define VXSXSDP(x) x
#else
# define VXS_CLASS "version::vxs"
# define VXSp(name) VXS_##name
@@ -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);
}