[libmath-prime-util-perl] 92/181: Fixes for 5.6.2
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:51:10 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.36
in repository libmath-prime-util-perl.
commit 3b96223ca9979a9b69b27c862bb004ec0fd204f0
Author: Dana Jacobsen <dana at acm.org>
Date: Wed Jan 1 02:42:46 2014 -0800
Fixes for 5.6.2
---
Makefile.PL | 2 +-
XS.xs | 7 +++++--
lib/Math/Prime/Util.pm | 2 +-
lib/Math/Prime/Util/PP.pm | 5 +++--
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 3a9d727..5d4ce36 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -42,7 +42,7 @@ WriteMakefile1(
PREREQ_PM => {
'Exporter' => '5.562',
'XSLoader' => '0.01',
- 'Carp' => 0,
+ 'Carp' => '1.17',
'Tie::Array' => 0,
'base' => 0,
'Config' => 0,
diff --git a/XS.xs b/XS.xs
index d681e8c..042d673 100644
--- a/XS.xs
+++ b/XS.xs
@@ -5,11 +5,14 @@
#include "perl.h"
#include "XSUB.h"
#include "multicall.h" /* only works in 5.6 and newer */
-/* We're not using anything for which we need ppport.h */
-#ifndef XSRETURN_UV /* Er, almost. Fix 21086 from Sep 2003 */
+/* Perhaps we should use ppport.h */
+#ifndef XSRETURN_UV /* Fix 21086 from Sep 2003 */
#define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) )
#define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END
#endif
+#if PERL_REVISION <= 5 && (PERL_VERSION < 7 || (PERL_VERSION == 7 && PERL_SUBVERSION <= 2))
+ #define SvPV_nomg SvPV
+#endif
#include "ptypes.h"
#include "cache.h"
#include "sieve.h"
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 2c23256..6623231 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -237,7 +237,7 @@ sub _validate_positive_integer {
$_[0] = Math::BigInt->new("$_[0]") unless ref($_[0]) eq 'Math::BigInt';
croak "Parameter '$_[0]' must be a positive integer" unless $_[0]->is_int();
- if ($_[0]->bacmp(''.~0) <= 0 && $] >= 5.008) {
+ if ($_[0]->bacmp(''.~0) <= 0) {
$_[0] = int($_[0]->bstr);
} else {
$_[0]->upgrade(undef) if $_[0]->upgrade(); # Stop BigFloat upgrade
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 987834e..8971021 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -77,8 +77,9 @@ sub _validate_num {
my($n, $min, $max) = @_;
croak "Parameter must be defined" if !defined $n;
return 0 if ref($n);
+ croak "Parameter must be a positive integer" if $n eq '';
croak "Parameter '$n' must be a positive integer"
- if $n eq '' || ($n =~ tr/0123456789//c && $n !~ /^\+\d+/);
+ if $n =~ tr/0123456789//c && $n !~ /^\+\d+/;
croak "Parameter '$n' must be >= $min" if defined $min && $n < $min;
croak "Parameter '$n' must be <= $max" if defined $max && $n > $max;
substr($_[0],0,1,'') if substr($n,0,1) eq '+';
@@ -94,7 +95,7 @@ sub _validate_positive_integer {
croak "Parameter '$n' must be >= $min" if defined $min && $n < $min;
croak "Parameter '$n' must be <= $max" if defined $max && $n > $max;
$_[0] = Math::BigInt->new("$_[0]") unless ref($_[0]) eq 'Math::BigInt';
- if ($_[0]->bacmp(''.~0) <= 0 && $] >= 5.008) {
+ if ($_[0]->bacmp(''.~0) <= 0) {
$_[0] = int($_[0]->bstr);
} else {
# Stop BigFloat upgrade
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git
More information about the Pkg-perl-cvs-commits
mailing list