X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=universal.c;h=03b907de0cb1d8770b55d496dcc8ff803a8ed242;hb=5dad0344e72a654bb2ed9a76760452bdb56c6e6d;hp=476b60d3c02b38b228f70a8289b7cb71662b9e8e;hpb=6f08146e2c3ab87e9f70e612981a0771a8acb8fb;p=p5sagit%2Fp5-mst-13.2.git diff --git a/universal.c b/universal.c index 476b60d..03b907d 100644 --- a/universal.c +++ b/universal.c @@ -170,26 +170,6 @@ XS(XS_UNIVERSAL_can) } static -XS(XS_UNIVERSAL_is_instance) -{ - dXSARGS; - ST(0) = SvROK(ST(0)) ? &sv_yes : &sv_no; - XSRETURN(1); -} - -static -XS(XS_UNIVERSAL_class) -{ - dXSARGS; - if(SvROK(ST(0)) && SvOBJECT(SvRV(ST(0)))) { - SV *sv = sv_newmortal(); - sv_setpv(sv, HvNAME(SvSTASH(SvRV(ST(0))))); - ST(0) = sv; - } - XSRETURN(1); -} - -static XS(XS_UNIVERSAL_VERSION) { dXSARGS; @@ -198,6 +178,7 @@ XS(XS_UNIVERSAL_VERSION) GV *gv; SV *sv; char *undef; + double req; if(SvROK(ST(0))) { sv = (SV*)SvRV(ST(0)); @@ -222,9 +203,9 @@ XS(XS_UNIVERSAL_VERSION) undef = "(undef)"; } - if(items > 1 && (undef || SvNV(ST(1)) > SvNV(sv))) + if (items > 1 && (undef || (req = SvNV(ST(1)), req > SvNV(sv)))) croak("%s version %s required--this is only version %s", - HvNAME(pkg),SvPV(ST(1),na),undef ? undef : SvPV(sv,na)); + HvNAME(pkg), SvPV(ST(1),na), undef ? undef : SvPV(sv,na)); ST(0) = sv; @@ -238,7 +219,5 @@ boot_core_UNIVERSAL() newXS("UNIVERSAL::isa", XS_UNIVERSAL_isa, file); newXS("UNIVERSAL::can", XS_UNIVERSAL_can, file); - newXS("UNIVERSAL::class", XS_UNIVERSAL_class, file); - newXS("UNIVERSAL::is_instance", XS_UNIVERSAL_is_instance, file); newXS("UNIVERSAL::VERSION", XS_UNIVERSAL_VERSION, file); }