diff options
author | Tels <nospam-abuse@bloodgate.com> | 2007-03-03 17:09:58 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-03-03 16:47:05 +0000 |
commit | caa6400115a38c0669db5e1b28eaa0eb8d1aad26 (patch) | |
tree | 4e6d4f51ea5110df0d48ac45ac4c880ff3356d7f /ext/Math | |
parent | 3fa583e00bcd0f1b80894cefde917ba28e8b2c38 (diff) | |
download | perl-caa6400115a38c0669db5e1b28eaa0eb8d1aad26.tar.gz |
Math::BigInt::FastCalc 0.12 (plug leaks)
Message-Id: <200703031710.00203@bloodgate.com>
p4raw-id: //depot/perl@30454
Diffstat (limited to 'ext/Math')
-rw-r--r-- | ext/Math/BigInt/FastCalc/FastCalc.pm | 4 | ||||
-rw-r--r-- | ext/Math/BigInt/FastCalc/FastCalc.xs | 55 |
2 files changed, 26 insertions, 33 deletions
diff --git a/ext/Math/BigInt/FastCalc/FastCalc.pm b/ext/Math/BigInt/FastCalc/FastCalc.pm index e49f64e9f7..23b9645580 100644 --- a/ext/Math/BigInt/FastCalc/FastCalc.pm +++ b/ext/Math/BigInt/FastCalc/FastCalc.pm @@ -1,6 +1,6 @@ package Math::BigInt::FastCalc; -use 5.005; +use 5.006002; use strict; # use warnings; # dont use warnings for older Perls @@ -11,7 +11,7 @@ use vars qw/@ISA $VERSION $BASE $BASE_LEN/; @ISA = qw(DynaLoader); -$VERSION = '0.11'; +$VERSION = '0.12'; bootstrap Math::BigInt::FastCalc $VERSION; diff --git a/ext/Math/BigInt/FastCalc/FastCalc.xs b/ext/Math/BigInt/FastCalc/FastCalc.xs index f99017154f..152eb0bcd1 100644 --- a/ext/Math/BigInt/FastCalc/FastCalc.xs +++ b/ext/Math/BigInt/FastCalc/FastCalc.xs @@ -230,51 +230,44 @@ _num(class,x) ############################################################################## -void -_zero(class) - INIT: - AV* a; +#define CONSTANT_OBJ(int) \ + RETVAL = newAV(); \ + sv_2mortal((SV*)RETVAL); \ + av_push (RETVAL, newSViv( int )); +AV * +_zero(class) CODE: - a = newAV(); - av_push (a, newSViv( 0 )); /* zero */ - ST(0) = newRV_noinc((SV*) a); + CONSTANT_OBJ(0) + OUTPUT: + RETVAL ############################################################################## -void +AV * _one(class) - INIT: - AV* a; - CODE: - a = newAV(); - av_push (a, newSViv( 1 )); /* one */ - ST(0) = newRV_noinc((SV*) a); + CONSTANT_OBJ(1) + OUTPUT: + RETVAL ############################################################################## -void +AV * _two(class) - INIT: - AV* a; - CODE: - a = newAV(); - av_push (a, newSViv( 2 )); /* two */ - ST(0) = newRV_noinc((SV*) a); + CONSTANT_OBJ(2) + OUTPUT: + RETVAL ############################################################################## -void +AV * _ten(class) - INIT: - AV* a; - CODE: - a = newAV(); - av_push (a, newSViv( 10 )); /* ten */ - ST(0) = newRV_noinc((SV*) a); + CONSTANT_OBJ(10) + OUTPUT: + RETVAL ############################################################################## @@ -388,15 +381,15 @@ _len(class,x) INIT: AV* a; SV* temp; - IV elems; + NV elems; STRLEN len; CODE: a = (AV*)SvRV(x); /* ref to aray, don't check ref */ - elems = av_len(a); /* number of elems in array */ + elems = (NV) av_len(a); /* number of elems in array */ temp = *av_fetch(a, elems, 0); /* fetch last element */ SvPV(temp, len); /* convert to string & store length */ - len += (IV) XS_BASE_LEN * elems; + len += XS_BASE_LEN * elems; ST(0) = newSViv(len); ############################################################################## |