From 7ffa7e7540d4523072b049e2d1285c34faabeeb9 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 21 Jul 2011 23:18:44 -0700 Subject: =?UTF-8?q?Don=E2=80=99t=20call=20get-magic=20twice=20for=20sym=20?= =?UTF-8?q?refs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dereferencing ops (${}, etc.) were calling get-magic on their operand twice if it was a symbolic reference, except for &{}. This commit fixes that, adding tests for all the deref ops, including &{}, for good measure. --- pp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'pp.c') diff --git a/pp.c b/pp.c index b6dabb5008..ccbbf35bd9 100644 --- a/pp.c +++ b/pp.c @@ -219,7 +219,15 @@ PP(pp_rv2gv) things. */ RETURN; } - sv = MUTABLE_SV(gv_fetchsv(sv, GV_ADD, SVt_PVGV)); + { + STRLEN len; + const char * const nambeg = SvPV_nomg_const(sv, len); + sv = MUTABLE_SV( + gv_fetchpvn_flags( + nambeg, len, GV_ADD | SvUTF8(sv), SVt_PVGV + ) + ); + } } /* FAKE globs in the symbol table cause weird bugs (#77810) */ if (sv) SvFAKE_off(sv); @@ -281,7 +289,9 @@ Perl_softref2xv(pTHX_ SV *const sv, const char *const what, } } else { - gv = gv_fetchsv(sv, GV_ADD, type); + STRLEN len; + const char * const nambeg = SvPV_nomg_const(sv, len); + gv = gv_fetchpvn_flags(nambeg, len, GV_ADD | SvUTF8(sv), type); } return gv; } -- cgit v1.2.1