diff options
author | Vincent Pit <perl@profvince.com> | 2009-03-29 01:02:55 +0100 |
---|---|---|
committer | Vincent Pit <perl@profvince.com> | 2009-03-29 01:04:03 +0100 |
commit | a214957f7efd783861273eacf23dbe881b0fca71 (patch) | |
tree | 67e9983880d7290b4d29425ec74fcee47639d995 /pp_hot.c | |
parent | 4b1c7d9edb7b995fb0cbc0224c3f2090bfa8e247 (diff) | |
download | perl-a214957f7efd783861273eacf23dbe881b0fca71.tar.gz |
Don't call SvPV_const() on the method name at the top of method_common(), as it's not needed when the method is in the current stash (which happens quite often)
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -3044,17 +3044,16 @@ S_method_common(pTHX_ SV* meth, U32* hashp) SV* ob; GV* gv; HV* stash; - STRLEN namelen; const char* packname = NULL; SV *packsv = NULL; STRLEN packlen; - const char * const name = SvPV_const(meth, namelen); SV * const sv = *(PL_stack_base + TOPMARK + 1); PERL_ARGS_ASSERT_METHOD_COMMON; if (!sv) - Perl_croak(aTHX_ "Can't call method \"%s\" on an undefined value", name); + Perl_croak(aTHX_ "Can't call method \"%"SVf"\" on an undefined value", + SVfARG(meth)); SvGETMAGIC(sv); if (SvROK(sv)) @@ -3083,7 +3082,8 @@ S_method_common(pTHX_ SV* meth, U32* hashp) : !isIDFIRST(*packname) )) { - Perl_croak(aTHX_ "Can't call method \"%s\" %s", name, + Perl_croak(aTHX_ "Can't call method \"%"SVf"\" %s", + SVfARG(meth), SvOK(sv) ? "without a package or object reference" : "on an undefined value"); } @@ -3108,6 +3108,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) && (ob = MUTABLE_SV(GvIO((const GV *)ob))) && SvOBJECT(ob)))) { + const char * const name = SvPV_nolen_const(meth); Perl_croak(aTHX_ "Can't call method \"%s\" on unblessed reference", (SvSCREAM(meth) && strEQ(name,"isa")) ? "DOES" : name); @@ -3131,7 +3132,8 @@ S_method_common(pTHX_ SV* meth, U32* hashp) } } - gv = gv_fetchmethod_flags(stash ? stash : MUTABLE_HV(packsv), name, + gv = gv_fetchmethod_flags(stash ? stash : MUTABLE_HV(packsv), + SvPV_nolen_const(meth), GV_AUTOLOAD | GV_CROAK); assert(gv); |