In perl.git, the branch smoke-me/tonyc/post-5.22 has been updated <http://perl5.git.perl.org/perl.git/commitdiff/18827a3b367759fb62305290e175715f6cd0ff8e?hp=8d553334382f1a98d9af7529e7fc367aeee0b051>
- Log ----------------------------------------------------------------- commit 18827a3b367759fb62305290e175715f6cd0ff8e Author: Daniel Dragan <[email protected]> Date: Sun May 10 23:45:58 2015 -0400 Perl_croak->croak and misc C optimizing in POSIX.pm On threaded perls, this reduces the overhead of the rarely executed error branches. croak does not have a context arg, Perl_croak does. This makes the machine code the error branches slightly smaller. update the manual xsub registration to use the new newXS_deffile added in 5.21, this saves 1 C stack arg and a hash lookup factor out ST(1234) from T_OPAQUEPTROBJ typemap entry, the CC must emit code to calculate ST() twice, due to sv_derived_from function possibly rewriting the world POSIX.dll on threaded VC 2003 32bit's .text dropped from 0x6c05 to 0x6b55 ----------------------------------------------------------------------- Summary of changes: ext/POSIX/POSIX.xs | 25 ++++++++++++------------- ext/POSIX/lib/POSIX.pm | 2 +- ext/POSIX/typemap | 14 ++++++++------ 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 43fad83..a81df95 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1660,7 +1660,6 @@ MODULE = POSIX PACKAGE = POSIX BOOT: { CV *cv; - const char *file = __FILE__; /* silence compiler warning about not_here() defined but not used */ @@ -1669,37 +1668,37 @@ BOOT: /* Ensure we get the function, not a macro implementation. Like the C89 standard says we can... */ #undef isalnum - cv = newXS("POSIX::isalnum", is_common, file); + cv = newXS_deffile("POSIX::isalnum", is_common); XSANY.any_dptr = (any_dptr_t) &isalnum; #undef isalpha - cv = newXS("POSIX::isalpha", is_common, file); + cv = newXS_deffile("POSIX::isalpha", is_common); XSANY.any_dptr = (any_dptr_t) &isalpha; #undef iscntrl - cv = newXS("POSIX::iscntrl", is_common, file); + cv = newXS_deffile("POSIX::iscntrl", is_common); XSANY.any_dptr = (any_dptr_t) &iscntrl; #undef isdigit - cv = newXS("POSIX::isdigit", is_common, file); + cv = newXS_deffile("POSIX::isdigit", is_common); XSANY.any_dptr = (any_dptr_t) &isdigit; #undef isgraph - cv = newXS("POSIX::isgraph", is_common, file); + cv = newXS_deffile("POSIX::isgraph", is_common); XSANY.any_dptr = (any_dptr_t) &isgraph; #undef islower - cv = newXS("POSIX::islower", is_common, file); + cv = newXS_deffile("POSIX::islower", is_common); XSANY.any_dptr = (any_dptr_t) &islower; #undef isprint - cv = newXS("POSIX::isprint", is_common, file); + cv = newXS_deffile("POSIX::isprint", is_common); XSANY.any_dptr = (any_dptr_t) &isprint; #undef ispunct - cv = newXS("POSIX::ispunct", is_common, file); + cv = newXS_deffile("POSIX::ispunct", is_common); XSANY.any_dptr = (any_dptr_t) &ispunct; #undef isspace - cv = newXS("POSIX::isspace", is_common, file); + cv = newXS_deffile("POSIX::isspace", is_common); XSANY.any_dptr = (any_dptr_t) &isspace; #undef isupper - cv = newXS("POSIX::isupper", is_common, file); + cv = newXS_deffile("POSIX::isupper", is_common); XSANY.any_dptr = (any_dptr_t) &isupper; #undef isxdigit - cv = newXS("POSIX::isxdigit", is_common, file); + cv = newXS_deffile("POSIX::isxdigit", is_common); XSANY.any_dptr = (any_dptr_t) &isxdigit; } @@ -1974,7 +1973,7 @@ WEXITSTATUS(status) #endif break; default: - Perl_croak(aTHX_ "Illegal alias %d for POSIX::W*", (int)ix); + croak("Illegal alias %d for POSIX::W*", (int)ix); } OUTPUT: RETVAL diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm index 96156bf..15eb5d6 100644 --- a/ext/POSIX/lib/POSIX.pm +++ b/ext/POSIX/lib/POSIX.pm @@ -4,7 +4,7 @@ use warnings; our ($AUTOLOAD, %SIGRT); -our $VERSION = '1.53'; +our $VERSION = '1.54'; require XSLoader; diff --git a/ext/POSIX/typemap b/ext/POSIX/typemap index e6a82dc..32cd17b 100644 --- a/ext/POSIX/typemap +++ b/ext/POSIX/typemap @@ -17,13 +17,15 @@ POSIX::SigAction T_HVREF INPUT T_OPAQUEPTROBJ - if (SvROK($arg) && sv_derived_from($arg, \"${ntype}\")) { - $var = ($type)SvPV_nolen(SvRV($arg)); + { + SV * sv = $arg; + if (SvROK(sv) && sv_derived_from(sv, \"${ntype}\")) + $var = ($type)SvPV_nolen(SvRV(sv)); + else + croak(\"%s: %s is not of type %s\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\", \"$ntype\"); } - else - Perl_croak(aTHX_ \"%s: %s is not of type %s\", - ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, - \"$var\", \"$ntype\") OUTPUT T_OPAQUEPTROBJ -- Perl5 Master Repository
