summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-07-21 23:18:44 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-07-21 23:44:17 -0700
commit7ffa7e7540d4523072b049e2d1285c34faabeeb9 (patch)
treed071fe530bd6712b5576ac342d3087e4a9fac0ac /pp.c
parentabcb810c88ac3af57afe0fd06c1c339f104b10f9 (diff)
downloadperl-7ffa7e7540d4523072b049e2d1285c34faabeeb9.tar.gz
Don’t call get-magic twice for sym refs
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.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c14
1 files changed, 12 insertions, 2 deletions
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;
}