diff options
author | syber <syber@crazypanda.ru> | 2014-12-09 01:36:23 +0300 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-12-08 16:08:52 -0800 |
commit | c290e187228e365708b7d5a9ae53ad10c3c002c6 (patch) | |
tree | a623fad6fe753fd7b6aecd146ab6d70e5f160a24 /gv.c | |
parent | d3ac2b769b5ecec58c3a4173895286445c881f8a (diff) | |
download | perl-c290e187228e365708b7d5a9ae53ad10c3c002c6.tar.gz |
Fix gv_fetchmeth_sv: it might stringify SV more than once.
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -636,8 +636,14 @@ of an SV instead of a string/length pair. GV * Perl_gv_fetchmeth_sv(pTHX_ HV *stash, SV *namesv, I32 level, U32 flags) { - PERL_ARGS_ASSERT_GV_FETCHMETH_SV; - return gv_fetchmeth_internal(stash, namesv, NULL, 0, level, flags); + char *namepv; + STRLEN namelen; + PERL_ARGS_ASSERT_GV_FETCHMETH_SV; + if (LIKELY(SvPOK_nog(namesv))) /* common case */ + return gv_fetchmeth_internal(stash, namesv, NULL, 0, level, flags); + namepv = SvPV(namesv, namelen); + if (SvUTF8(namesv)) flags |= SVf_UTF8; + return gv_fetchmeth_pvn(stash, namepv, namelen, level, flags); } /* |