summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2001-03-14 07:01:29 +0000
committerGurusamy Sarathy <gsar@cpan.org>2001-03-14 07:01:29 +0000
commit9a135c90b92a02e2daa86f93310af425135463f4 (patch)
treef827ea54a94fcdcd6ec684a8fb23109327b1ed83 /op.c
parentf06c8e5ba202f1bd58e7b5728b75fa5fa0032675 (diff)
downloadperl-9a135c90b92a02e2daa86f93310af425135463f4.tar.gz
reenable change#9145 (the test was busted due to a missing
C<print "ok 27\n">) p4raw-link: @9145 on //depot/perl: 4af0bda917eceeead6e59e5dc7c6b28fce055a0a p4raw-id: //depot/perl@9151
Diffstat (limited to 'op.c')
-rw-r--r--op.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/op.c b/op.c
index 421dc9e69d..5623e146ad 100644
--- a/op.c
+++ b/op.c
@@ -843,6 +843,29 @@ S_op_clear(pTHX_ OP *o)
case OP_MATCH:
case OP_QR:
clear_pmop:
+ {
+ HV *pmstash = PmopSTASH(cPMOPo);
+ if (pmstash) {
+ PMOP *pmop = HvPMROOT(pmstash);
+ PMOP *lastpmop = NULL;
+ while (pmop) {
+ if (cPMOPo == pmop) {
+ if (lastpmop)
+ lastpmop->op_pmnext = pmop->op_pmnext;
+ else
+ HvPMROOT(pmstash) = pmop->op_pmnext;
+ break;
+ }
+ lastpmop = pmop;
+ pmop = pmop->op_pmnext;
+ }
+#ifdef USE_ITHREADS
+ Safefree(PmopSTASHPV(cPMOPo));
+#else
+ /* NOTE: PMOP.op_pmstash is not refcounted */
+#endif
+ }
+ }
cPMOPo->op_pmreplroot = Nullop;
ReREFCNT_dec(cPMOPo->op_pmregexp);
cPMOPo->op_pmregexp = (REGEXP*)NULL;
@@ -2935,6 +2958,7 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags)
if (type != OP_TRANS && PL_curstash) {
pmop->op_pmnext = HvPMROOT(PL_curstash);
HvPMROOT(PL_curstash) = pmop;
+ PmopSTASH_set(pmop,PL_curstash);
}
return (OP*)pmop;