diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-09-10 17:14:31 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-09-14 11:49:37 +0200 |
commit | 70e1279abb4368eade75848c2010a9bd421908b5 (patch) | |
tree | 781b565b56023a5e1cbe0327936118da6d54b2a5 | |
parent | 22570a88de5a23b9f3a8a216f0a19cef783a03c1 (diff) | |
download | perl-70e1279abb4368eade75848c2010a9bd421908b5.tar.gz |
Restore 5.004 and 5.005 support in Storable.
Add XSLoader as a prerequisite.
Use parentheses for the call to XSLoader::load().
Don't pass parameters that old ExtUtil::MakeMaker doesn't understand.
Avoid the T_BOOL typemap, as xsubpp will always mortalise the SV generated
by processing RETVAL, T_BOOL generates the SV using boolSV() which returns
PL_sv_yes or PL_sv_no, and on 5.004 Perl_sv_2mortal() will croak if passed
a readonly scalar. This is actually a small optimisation on later perls, as
the call to Perl_sv_2mortal() isn't actually needed.
Avoid repeating the PPCODE by merging last_op_in_netorder() with
is_storing() and is_retrieving(). (Which I didn't spot was easy to do
when commit 7cb18e1b020cd2e5 merged is_storing() and is_retrieving().)
Together these reduce the size of the shared object by about 200 bytes on
this platform. Small, but in the right direction.
-rw-r--r-- | dist/Storable/Makefile.PL | 5 | ||||
-rw-r--r-- | dist/Storable/Storable.pm | 2 | ||||
-rw-r--r-- | dist/Storable/Storable.xs | 29 |
3 files changed, 18 insertions, 18 deletions
diff --git a/dist/Storable/Makefile.PL b/dist/Storable/Makefile.PL index e40f5c56d2..bcfd9e0cff 100644 --- a/dist/Storable/Makefile.PL +++ b/dist/Storable/Makefile.PL @@ -13,11 +13,14 @@ WriteMakefile( DISTNAME => "Storable", # We now ship this in t/ # PREREQ_PM => { 'Test::More' => '0.41' }, + PREREQ_PM => { XSLoader => 0 }, INSTALLDIRS => $] >= 5.007 ? 'perl' : 'site', VERSION_FROM => 'Storable.pm', - META_MERGE => { resources => + ($ExtUtils::MakeMaker::VERSION > 6.45 ? + (META_MERGE => { resources => { bugtracker => 'http://rt.perl.org/perlbug/' } }, + ) : ()), dist => { SUFFIX => 'gz', COMPRESS => 'gzip -f' }, ); diff --git a/dist/Storable/Storable.pm b/dist/Storable/Storable.pm index 76d54860b7..3e995c396d 100644 --- a/dist/Storable/Storable.pm +++ b/dist/Storable/Storable.pm @@ -69,7 +69,7 @@ sub CLONE { $Storable::downgrade_restricted = 1; $Storable::accept_future_minor = 1; -XSLoader::load 'Storable', $Storable::VERSION; +XSLoader::load('Storable', $Storable::VERSION); # # Determine whether locking is possible, but only when needed. diff --git a/dist/Storable/Storable.xs b/dist/Storable/Storable.xs index 5d95fe5e22..9b4bb463ba 100644 --- a/dist/Storable/Storable.xs +++ b/dist/Storable/Storable.xs @@ -6438,23 +6438,20 @@ SV * sv OUTPUT: RETVAL -bool +void last_op_in_netorder() - CODE: - RETVAL = !!last_op_in_netorder(aTHX); - OUTPUT: - RETVAL - -bool -is_storing() ALIAS: is_storing = ST_STORE is_retrieving = ST_RETRIEVE - CODE: - { - dSTCXT; - - RETVAL = cxt->entry && (cxt->optype & ix) ? TRUE : FALSE; - } - OUTPUT: - RETVAL + PREINIT: + bool result; + PPCODE: + if (ix) { + dSTCXT; + + result = cxt->entry && (cxt->optype & ix) ? TRUE : FALSE; + } else { + result = !!last_op_in_netorder(aTHX); + } + ST(0) = boolSV(result); + XSRETURN(1); |