X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=universal.c;h=7d8ced3b0fa2f8fa2b83ccb09cda80a913d8bdee;hb=f2a260d65825b8794898c1b0c7b02230f7d5398e;hp=bf03261db78fed6d07c33c54530ed7a59d0abd2f;hpb=3280af22f58e7b37514ed104858e2c2fc55ceeeb;p=p5sagit%2Fp5-mst-13.2.git diff --git a/universal.c b/universal.c index bf03261..7d8ced3 100644 --- a/universal.c +++ b/universal.c @@ -7,7 +7,7 @@ */ STATIC SV * -isa_lookup(HV *stash, char *name, int len, int level) +isa_lookup(HV *stash, const char *name, int len, int level) { AV* av; GV* gv; @@ -53,8 +53,10 @@ isa_lookup(HV *stash, char *name, int len, int level) SV* sv = *svp++; HV* basestash = gv_stashsv(sv, FALSE); if (!basestash) { - if (PL_dowarn) - warn("Can't locate package %s for @%s::ISA", + dTHR; + if (ckWARN(WARN_MISC)) + warner(WARN_SYNTAX, + "Can't locate package %s for @%s::ISA", SvPVX(sv), HvNAME(stash)); continue; } @@ -71,7 +73,7 @@ isa_lookup(HV *stash, char *name, int len, int level) } bool -sv_derived_from(SV *sv, char *name) +sv_derived_from(SV *sv, const char *name) { SV *rv; char *type; @@ -106,24 +108,23 @@ sv_derived_from(SV *sv, char *name) #include "XSUB.h" -static XS(XS_UNIVERSAL_isa) { dXSARGS; SV *sv; char *name; + STRLEN n_a; if (items != 2) croak("Usage: UNIVERSAL::isa(reference, kind)"); sv = ST(0); - name = (char *)SvPV(ST(1),PL_na); + name = (char *)SvPV(ST(1),n_a); ST(0) = boolSV(sv_derived_from(sv, name)); XSRETURN(1); } -static XS(XS_UNIVERSAL_can) { dXSARGS; @@ -131,12 +132,13 @@ XS(XS_UNIVERSAL_can) char *name; SV *rv; HV *pkg = NULL; + STRLEN n_a; if (items != 2) croak("Usage: UNIVERSAL::can(object-ref, method)"); sv = ST(0); - name = (char *)SvPV(ST(1),PL_na); + name = (char *)SvPV(ST(1),n_a); rv = &PL_sv_undef; if(SvROK(sv)) { @@ -158,7 +160,6 @@ XS(XS_UNIVERSAL_can) XSRETURN(1); } -static XS(XS_UNIVERSAL_VERSION) { dXSARGS; @@ -192,9 +193,11 @@ XS(XS_UNIVERSAL_VERSION) undef = "(undef)"; } - if (items > 1 && (undef || (req = SvNV(ST(1)), req > SvNV(sv)))) + if (items > 1 && (undef || (req = SvNV(ST(1)), req > SvNV(sv)))) { + STRLEN n_a; croak("%s version %s required--this is only version %s", - HvNAME(pkg), SvPV(ST(1),PL_na), undef ? undef : SvPV(sv,PL_na)); + HvNAME(pkg), SvPV(ST(1),n_a), undef ? undef : SvPV(sv,n_a)); + } ST(0) = sv;