diff options
author | Brian Fraser <fraserbn@gmail.com> | 2011-09-26 08:27:59 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-10-06 13:01:07 -0700 |
commit | f937af422282fa774bb1c803f5b67d95d8283b7e (patch) | |
tree | 74d5af077ddf0ae8ed69ab87460b83a373c8f221 /pp_hot.c | |
parent | 14d1dfbd5a7729c29625907ff4fb08dc71a2059e (diff) | |
download | perl-f937af422282fa774bb1c803f5b67d95d8283b7e.tar.gz |
pp_hot.c: method_common is UTF-8 aware.
Not really useful yet, since named methods aren't correctly
flagged; that is to access a \x{30cb} method, you'd need
to do something like Obj->${\"\x{30cb}"}.
Committer’s note: I’m also including one piece of the ‘gv.c and
pp_ctl.c warnings’ patch so that the newly-added tests in this
commit pass.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -2933,9 +2933,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) SV* ob; GV* gv; HV* stash; - const char* packname = NULL; SV *packsv = NULL; - STRLEN packlen; SV * const sv = *(PL_stack_base + TOPMARK + 1); PERL_ARGS_ASSERT_METHOD_COMMON; @@ -2949,6 +2947,8 @@ S_method_common(pTHX_ SV* meth, U32* hashp) ob = MUTABLE_SV(SvRV(sv)); else { GV* iogv; + STRLEN packlen; + const char * packname = NULL; bool packname_is_utf8 = FALSE; /* this isn't a reference */ @@ -2985,12 +2985,13 @@ S_method_common(pTHX_ SV* meth, U32* hashp) : "on an undefined value"); } /* assume it's a package name */ - stash = gv_stashpvn(packname, packlen, 0); + stash = gv_stashpvn(packname, packlen, packname_is_utf8 ? SVf_UTF8 : 0); if (!stash) packsv = sv; else { SV* const ref = newSViv(PTR2IV(stash)); - (void)hv_store(PL_stashcache, packname, packlen, ref, 0); + (void)hv_store(PL_stashcache, packname, + packname_is_utf8 ? -packlen : packlen, ref, 0); } goto fetch; } @@ -3029,9 +3030,8 @@ S_method_common(pTHX_ SV* meth, U32* hashp) } } - gv = gv_fetchmethod_flags(stash ? stash : MUTABLE_HV(packsv), - SvPV_nolen_const(meth), - GV_AUTOLOAD | GV_CROAK); + gv = gv_fetchmethod_sv_flags(stash ? stash : MUTABLE_HV(packsv), + meth, GV_AUTOLOAD | GV_CROAK); assert(gv); |