From: Andy Lester Date: Sat, 18 Mar 2006 00:28:45 +0000 (-0600) Subject: Change the semantics of S_isa_lookup X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a9ec700ee9a7d3c376e5e0364a53953654bcc8ea;p=p5sagit%2Fp5-mst-13.2.git Change the semantics of S_isa_lookup Message-ID: <20060318062845.GA11607@petdance.com> p4raw-id: //depot/perl@27542 --- diff --git a/embed.fnc b/embed.fnc index 7dbdd58..46ccb40 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1431,7 +1431,7 @@ s |int |tokereport |I32 rv #endif #if defined(PERL_IN_UNIVERSAL_C) || defined(PERL_DECL_PROT) -s |SV*|isa_lookup |NULLOK HV *stash|NN const char *name|NULLOK HV *name_stash|int len|int level +s |bool|isa_lookup |NULLOK HV *stash|NN const char *name|NULLOK HV *name_stash|int len|int level #endif #if defined(PERL_IN_LOCALE_C) || defined(PERL_DECL_PROT) diff --git a/proto.h b/proto.h index 1e42b7f..b84c409 100644 --- a/proto.h +++ b/proto.h @@ -3904,7 +3904,7 @@ STATIC int S_tokereport(pTHX_ I32 rv); #endif #if defined(PERL_IN_UNIVERSAL_C) || defined(PERL_DECL_PROT) -STATIC SV* S_isa_lookup(pTHX_ HV *stash, const char *name, HV *name_stash, int len, int level) +STATIC bool S_isa_lookup(pTHX_ HV *stash, const char *name, HV *name_stash, int len, int level) __attribute__nonnull__(pTHX_2); #endif diff --git a/universal.c b/universal.c index 98efe0f..8802cb2 100644 --- a/universal.c +++ b/universal.c @@ -31,7 +31,7 @@ * The main guts of traverse_isa was actually copied from gv_fetchmeth */ -STATIC SV * +STATIC bool S_isa_lookup(pTHX_ HV *stash, const char *name, HV* name_stash, int len, int level) { @@ -46,15 +46,15 @@ S_isa_lookup(pTHX_ HV *stash, const char *name, HV* name_stash, /* A stash/class can go by many names (ie. User == main::User), so we compare the stash itself just in case */ if (name_stash && (stash == name_stash)) - return &PL_sv_yes; + return TRUE; hvname = HvNAME_get(stash); if (strEQ(hvname, name)) - return &PL_sv_yes; + return TRUE; if (strEQ(name, "UNIVERSAL")) - return &PL_sv_yes; + return TRUE; if (level > 100) Perl_croak(aTHX_ "Recursive inheritance detected in package '%s'", @@ -71,7 +71,7 @@ S_isa_lookup(pTHX_ HV *stash, const char *name, HV* name_stash, if (svp && (sv = *svp) != (SV*)&PL_sv_undef) { DEBUG_o( Perl_deb(aTHX_ "Using cached ISA %s for package %s\n", name, hvname) ); - return sv; + return (sv == &PL_sv_yes); } } else { @@ -114,16 +114,15 @@ S_isa_lookup(pTHX_ HV *stash, const char *name, HV* name_stash, sv, hvname); continue; } - if (&PL_sv_yes == isa_lookup(basestash, name, name_stash, - len, level + 1)) { + if (isa_lookup(basestash, name, name_stash, len, level + 1)) { (void)hv_store(hv,name,len,&PL_sv_yes,0); - return &PL_sv_yes; + return TRUE; } } (void)hv_store(hv,name,len,&PL_sv_no,0); } } - return &PL_sv_no; + return FALSE; } /* @@ -160,7 +159,7 @@ Perl_sv_derived_from(pTHX_ SV *sv, const char *name) if (stash) { HV * const name_stash = gv_stashpv(name, FALSE); - return isa_lookup(stash, name, name_stash, strlen(name), 0) == &PL_sv_yes; + return isa_lookup(stash, name, name_stash, strlen(name), 0); } else return FALSE;