diff options
author | Andy Lester <andy@petdance.com> | 2005-12-22 10:00:44 -0600 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-12-23 00:27:50 +0000 |
commit | 0b6f4f5cb8bbeb6c5d1eb714dbf6cdf58c5516d7 (patch) | |
tree | d519f94f6a18b62150af56bb384b776070041ca8 /universal.c | |
parent | 9a66ea416324d5cd1459c59e545b38c9c889fdaa (diff) | |
download | perl-0b6f4f5cb8bbeb6c5d1eb714dbf6cdf58c5516d7.tar.gz |
Speed up Perl_sv_derived_from
Message-ID: <20051222220044.GH4370@petdance.com>
Date: Thu, 22 Dec 2005 16:00:44 -0600
p4raw-id: //depot/perl@26461
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/universal.c b/universal.c index 097cc64e07..24aa3b8e48 100644 --- a/universal.c +++ b/universal.c @@ -140,29 +140,29 @@ for class names as well as for objects. bool Perl_sv_derived_from(pTHX_ SV *sv, const char *name) { - const char *type = NULL; - HV *stash = NULL; - HV *name_stash; + HV *stash; SvGETMAGIC(sv); if (SvROK(sv)) { + const char *type; sv = SvRV(sv); type = sv_reftype(sv,0); - if (SvOBJECT(sv)) - stash = SvSTASH(sv); + if (type && strEQ(type,name)) + return TRUE; + stash = SvOBJECT(sv) ? SvSTASH(sv) : NULL; } else { stash = gv_stashsv(sv, FALSE); } - name_stash = gv_stashpv(name, FALSE); + if (stash) { + HV * const name_stash = gv_stashpv(name, FALSE); + return isa_lookup(stash, name, name_stash, strlen(name), 0) == &PL_sv_yes; + } + else + return FALSE; - return (type && strEQ(type,name)) || - (stash && isa_lookup(stash, name, name_stash, strlen(name), 0) - == &PL_sv_yes) - ? TRUE - : FALSE ; } #include "XSUB.h" |