summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2014-11-06 23:57:14 -0500
committerFather Chrysostomos <sprout@cpan.org>2014-11-06 21:50:43 -0800
commit0e42d607f5f6c7f9dcca70d0d07f7d7f5dca5774 (patch)
tree63ee1b5a04098da8325e49bf2782c6bc373a9f9b /util.c
parent9d22ccf6b40a09ba97011e2b50fde44e4eb71aa6 (diff)
downloadperl-0e42d607f5f6c7f9dcca70d0d07f7d7f5dca5774.tar.gz
simplify Perl_xs_apiversion_bootcheck
We control both strings. Perl API versions are not old decimal or alphas versions. Maints dont increase Perl API ver. Just do a memcmp. Faster and less machine code. Before 0xA6 bytes of machine code on VC 2003 32b, after 0x35. This patch is related to [perl #123136].
Diffstat (limited to 'util.c')
-rw-r--r--util.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/util.c b/util.c
index eadd21de87..d12ac8895d 100644
--- a/util.c
+++ b/util.c
@@ -5380,34 +5380,16 @@ Perl_xs_version_bootcheck(pTHX_ U32 items, U32 ax, const char *xs_p,
}
void
-Perl_xs_apiversion_bootcheck(pTHX_ SV *module, const char *api_p,
+Perl_xs_apiversion_bootcheck(SV *module, const char *api_p,
STRLEN api_len)
{
- SV *xpt = NULL;
- SV *compver = Perl_newSVpvn_flags(aTHX_ api_p, api_len, SVs_TEMP);
- SV *runver;
-
PERL_ARGS_ASSERT_XS_APIVERSION_BOOTCHECK;
- /* This might croak */
- compver = upg_version(compver, 0);
- /* This should never croak */
- runver = new_version(PL_apiversion);
- if (vcmp(compver, runver)) {
- SV *compver_string = vstringify(compver);
- SV *runver_string = vstringify(runver);
- xpt = Perl_newSVpvf(aTHX_ "Perl API version %"SVf
- " of %"SVf" does not match %"SVf,
- SVfARG(compver_string), SVfARG(module),
- SVfARG(runver_string));
- Perl_sv_2mortal(aTHX_ xpt);
-
- SvREFCNT_dec(compver_string);
- SvREFCNT_dec(runver_string);
- }
- SvREFCNT_dec(runver);
- if (xpt)
- Perl_croak_sv(aTHX_ xpt);
+ if(api_len != sizeof("v" PERL_API_VERSION_STRING)-1
+ || memNE(api_p, "v" PERL_API_VERSION_STRING, sizeof("v" PERL_API_VERSION_STRING)-1)) {
+ Perl_croak_nocontext("Perl API version %s of %"SVf" does not match %s",
+ api_p, SVfARG(module), "v" PERL_API_VERSION_STRING);
+ }
}
/*