summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-01 13:06:27 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-01 13:07:30 -0800
commit8756617677dbda9a9ac19ac3155ca3bbabbf75a8 (patch)
tree278710b46c7769f71bb732a6ad4db5f158658453 /op.c
parent62f789982833b2c6a9005f78da558557992fcf8f (diff)
downloadperl-8756617677dbda9a9ac19ac3155ca3bbabbf75a8.tar.gz
Simplify gv:S_maybe_add_coresub
It was working around the fact that newATTRSUB expects to be able to look up the GV by name. And for speed, it was going through hoops to try to avoid creating extra SVs holding the name unnecessarily. By tweaking newATTRSUB to accept a GV instead of a name, we can sim- plify not only S_maybe_add_coresub but all its callers, too.
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/op.c b/op.c
index 3e6b0b9135..f0ac7b99bf 100644
--- a/op.c
+++ b/op.c
@@ -6469,7 +6469,9 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
ps = NULL;
if (name) {
- gv = gv_fetchsv(cSVOPo->op_sv, gv_fetch_flags, SVt_PVCV);
+ gv = isGV(cSVOPo->op_sv)
+ ? (GV *)cSVOPo->op_sv
+ : gv_fetchsv(cSVOPo->op_sv, gv_fetch_flags, SVt_PVCV);
has_name = TRUE;
} else if (PERLDB_NAMEANON && CopLINE(PL_curcop)) {
SV * const sv = sv_newmortal();