summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-10-25 23:34:23 +0100
committerFather Chrysostomos <sprout@cpan.org>2010-10-25 17:45:14 -0700
commitc68d956458c78806cbdba85dfe23247f62e143d5 (patch)
treec61fbddcbc0d54a524e6ae2c5c1b4a65a60319b3 /op.c
parent3ba4b5c12a24a4d2dd2388527109b05429b3565c (diff)
downloadperl-c68d956458c78806cbdba85dfe23247f62e143d5.tar.gz
add CvSTASH_set() macro and make CvSTASH() rvalue only
Now that CvSTASH requires backreference bookkeeping, stop people from directly assigning to it (by using CvSTASH() as an lvalue), and instead force them to use CvSTASH_set().
Diffstat (limited to 'op.c')
-rw-r--r--op.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/op.c b/op.c
index 21f8e970bc..cfa9d6b686 100644
--- a/op.c
+++ b/op.c
@@ -6279,8 +6279,6 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
pad_fixup_inner_anons(CvPADLIST(cv), PL_compcv, cv);
if (PERLDB_INTER)/* Advice debugger on the new sub. */
++PL_sub_generation;
- if (CvSTASH(cv))
- sv_del_backref(MUTABLE_SV(CvSTASH(cv)), MUTABLE_SV(cv));
}
else {
/* Might have had built-in attributes applied -- propagate them. */
@@ -6308,9 +6306,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
if (!CvGV(cv)) {
CvGV_set(cv, gv);
CvFILE_set_from_cop(cv, PL_curcop);
- CvSTASH(cv) = PL_curstash;
- if (PL_curstash)
- Perl_sv_add_backref(aTHX_ MUTABLE_SV(PL_curstash), MUTABLE_SV(cv));
+ CvSTASH_set(cv, PL_curstash);
}
if (attrs) {
/* Need to do a C<use attributes $stash_of_cv,\&cv,@attrs>. */