summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2011-09-26 08:27:59 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-10-06 13:01:07 -0700
commitf937af422282fa774bb1c803f5b67d95d8283b7e (patch)
tree74d5af077ddf0ae8ed69ab87460b83a373c8f221 /pp_hot.c
parent14d1dfbd5a7729c29625907ff4fb08dc71a2059e (diff)
downloadperl-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.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/pp_hot.c b/pp_hot.c
index cd2b3f5831..59268745b2 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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);