summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-05-20 22:53:00 +0000
committerNicholas Clark <nick@ccl4.org>2005-05-20 22:53:00 +0000
commit8d2f45362e368d7dd455b476c924dcbcc02d845b (patch)
tree59781bff974e66889d582302526cc2308af6d0c1 /op.c
parentaec614a53fcaa2a63038ec4dcf0fcd1cda92fd31 (diff)
downloadperl-8d2f45362e368d7dd455b476c924dcbcc02d845b.tar.gz
Remove PMROOT and replace it with a small shell script. Er, magic.
(PMROOT being needed to implement bare C<reset> - how often do you use that?) p4raw-id: //depot/perl@24522
Diffstat (limited to 'op.c')
-rw-r--r--op.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/op.c b/op.c
index dc70613cca..c8eff92b3b 100644
--- a/op.c
+++ b/op.c
@@ -407,18 +407,21 @@ clear_pmop:
{
HV *pmstash = PmopSTASH(cPMOPo);
if (pmstash && SvREFCNT(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;
+ MAGIC *mg = mg_find((SV*)pmstash, PERL_MAGIC_symtab);
+ if (mg) {
+ PMOP *pmop = (PMOP*) mg->mg_obj;
+ PMOP *lastpmop = NULL;
+ while (pmop) {
+ if (cPMOPo == pmop) {
+ if (lastpmop)
+ lastpmop->op_pmnext = pmop->op_pmnext;
+ else
+ mg->mg_obj = (SV*) pmop->op_pmnext;
+ break;
+ }
+ lastpmop = pmop;
+ pmop = pmop->op_pmnext;
}
- lastpmop = pmop;
- pmop = pmop->op_pmnext;
}
}
PmopSTASH_free(cPMOPo);
@@ -2724,8 +2727,13 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags)
/* link into pm list */
if (type != OP_TRANS && PL_curstash) {
- pmop->op_pmnext = HvPMROOT(PL_curstash);
- HvPMROOT(PL_curstash) = pmop;
+ MAGIC *mg = mg_find((SV*)PL_curstash, PERL_MAGIC_symtab);
+
+ if (!mg) {
+ mg = sv_magicext((SV*)PL_curstash, 0, PERL_MAGIC_symtab, 0, 0, 0);
+ }
+ pmop->op_pmnext = (PMOP*)mg->mg_obj;
+ mg->mg_obj = (SV*)pmop;
PmopSTASH_set(pmop,PL_curstash);
}