From 89269094eac2074a779834560b45a2b374322023 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Wed, 4 Jul 2012 12:51:31 -0700 Subject: [PATCH] pp_hot.c: Clean up after the prev commit Even before that it was more complicated than necessary, as SvPV_nomg_const never returns null. --- pp_hot.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pp_hot.c b/pp_hot.c index 7b71474..4100ae2 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2965,34 +2965,29 @@ S_method_common(pTHX_ SV* meth, U32* hashp) ob = MUTABLE_SV(SvRV(sv)); else if (!SvOK(sv)) goto undefined; else { + /* this isn't a reference */ GV* iogv; STRLEN packlen; - const char * packname = NULL; + const char * const packname = SvPV_nomg_const(sv, packlen); bool packname_is_utf8 = FALSE; - - /* this isn't a reference */ - if(SvOK(sv) && (packname = SvPV_nomg_const(sv, packlen))) { - const HE* const he = + const HE* const he = (const HE *)hv_common_key_len( PL_stashcache, packname, packlen * -(packname_is_utf8 = !!SvUTF8(sv)), 0, NULL, 0 ); - if (he) { + if (he) { stash = INT2PTR(HV*,SvIV(HeVAL(he))); goto fetch; - } } - if (!SvOK(sv) || - !(packname) || - !(iogv = gv_fetchpvn_flags( + if (!(iogv = gv_fetchpvn_flags( packname, packlen, SVf_UTF8 * packname_is_utf8, SVt_PVIO )) || !(ob=MUTABLE_SV(GvIO(iogv)))) { /* this isn't the name of a filehandle either */ - if (!packname || !packlen) + if (!packlen) { Perl_croak(aTHX_ "Can't call method \"%"SVf"\" " "without a package or object reference", -- 2.7.4