From: Dan Sugalski Date: Mon, 19 Dec 2005 23:51:47 +0000 (-0800) Subject: import Devel-Size 0.64 from CPAN X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24d379770f87042345cf7170e7f4239fbf46890e;p=p5sagit%2FDevel-Size.git import Devel-Size 0.64 from CPAN git-cpan-module: Devel-Size git-cpan-version: 0.64 git-cpan-authorid: DSUGAL git-cpan-file: authors/id/D/DS/DSUGAL/Devel-Size-0.64.tar.gz --- diff --git a/Changes b/Changes index c0f2a2c..3815b8c 100755 --- a/Changes +++ b/Changes @@ -47,3 +47,8 @@ Revision history for Perl extension Devel::Size. - Turns out that OP_TRANS is a basic op, not a loop op. This is a bug in versions of perl 5.8.x before 5.8.7. Work around it. + +0.64 Mon Dec 19 18:46:00 2005 + - Patch to make Devel::Size compile on bleadperl (Courtesy of + Nick Clark) + - Fix up the PVIV string size calcs (Courtesy of Andrew Shirrayev) \ No newline at end of file diff --git a/META.yml b/META.yml index fb3c857..4c20f43 100644 --- a/META.yml +++ b/META.yml @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Devel-Size -version: 0.63 +version: 0.64 version_from: Size.pm installdirs: site requires: diff --git a/Size.pm b/Size.pm index e0e6f7e..5c4ffba 100755 --- a/Size.pm +++ b/Size.pm @@ -24,7 +24,7 @@ require DynaLoader; @EXPORT = qw( ); -$VERSION = '0.63'; +$VERSION = '0.64'; bootstrap Devel::Size $VERSION; diff --git a/Size.xs b/Size.xs index 5fde288..76a4f55 100755 --- a/Size.xs +++ b/Size.xs @@ -150,7 +150,7 @@ static int go_yell = 1; pointer as the length. Perl then uses the four (or eight, on 64-bit machines) bytes of the address as the string we're using as the key */ -IV check_new(HV *tracking_hash, void *thing) { +IV check_new(HV *tracking_hash, const void *thing) { if (NULL == thing) { return FALSE; } @@ -353,6 +353,10 @@ UV op_size(OP *baseop, HV *tracking_hash) { return total_size; } +#if PERL_VERSION > 9 || (PERL_VERSION == 9 && PERL_SUBVERSION > 2) +# define NEW_HEAD_LAYOUT +#endif + UV thing_size(SV *orig_thing, HV *tracking_hash) { SV *thing = orig_thing; UV total_size = sizeof(SV); @@ -364,10 +368,12 @@ UV thing_size(SV *orig_thing, HV *tracking_hash) { /* Just a plain integer. This will be differently sized depending on whether purify's been compiled in */ case SVt_IV: -#ifdef PURIFY +#ifndef NEW_HEAD_LAYOUT +# ifdef PURIFY total_size += sizeof(sizeof(XPVIV)); -#else +# else total_size += sizeof(IV); +# endif #endif break; /* Is it a float? Like the int, it depends on purify */ @@ -380,7 +386,9 @@ UV thing_size(SV *orig_thing, HV *tracking_hash) { break; /* Is it a reference? */ case SVt_RV: +#ifndef NEW_HEAD_LAYOUT total_size += sizeof(XRV); +#endif break; /* How about a plain string? In which case we need to add in how much has been allocated */ @@ -392,6 +400,7 @@ UV thing_size(SV *orig_thing, HV *tracking_hash) { case SVt_PVIV: total_size += sizeof(XPVIV); total_size += SvLEN(thing); + total_size += SvIVX(thing); break; /* A string with a float part? */ case SVt_PVNV: @@ -544,7 +553,7 @@ UV thing_size(SV *orig_thing, HV *tracking_hash) { case SVt_PVIO: total_size += sizeof(XPVIO); total_size += magic_size(thing, tracking_hash); - if (check_new(tracking_hash, ((XPVIO *) SvANY(thing))->xpv_pv)) { + if (check_new(tracking_hash, (SvPVX(thing)))) { total_size += ((XPVIO *) SvANY(thing))->xpv_cur; } /* Some embedded char pointers */