From: Gurusamy Sarathy Date: Wed, 14 Mar 2001 07:01:29 +0000 (+0000) Subject: reenable change#9145 (the test was busted due to a missing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9a135c90b92a02e2daa86f93310af425135463f4;p=p5sagit%2Fp5-mst-13.2.git reenable change#9145 (the test was busted due to a missing C) p4raw-link: @9145 on //depot/perl: 4af0bda917eceeead6e59e5dc7c6b28fce055a0a p4raw-id: //depot/perl@9151 --- diff --git a/op.c b/op.c index 421dc9e..5623e14 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; diff --git a/op.h b/op.h index 6c62942..f7bd4b0 100644 --- a/op.h +++ b/op.h @@ -242,6 +242,11 @@ struct pmop { U16 op_pmflags; U16 op_pmpermflags; U8 op_pmdynflags; +#ifdef USE_ITHREADS + char * op_pmstashpv; +#else + HV * op_pmstash; +#endif }; #define PMdf_USED 0x01 /* pm has been used once already */ @@ -271,6 +276,20 @@ struct pmop { /* mask of bits stored in regexp->reganch */ #define PMf_COMPILETIME (PMf_MULTILINE|PMf_SINGLELINE|PMf_LOCALE|PMf_FOLD|PMf_EXTENDED) +#ifdef USE_ITHREADS +# define PmopSTASHPV(o) ((o)->op_pmstashpv) +# define PmopSTASHPV_set(o,pv) ((o)->op_pmstashpv = ((pv) ? savepv(pv) : Nullch)) +# define PmopSTASH(o) (PmopSTASHPV(o) \ + ? gv_stashpv(PmopSTASHPV(o),GV_ADD) : Nullhv) +# define PmopSTASH_set(o,hv) PmopSTASHPV_set(o, (hv) ? HvNAME(hv) : Nullch) +#else +# define PmopSTASH(o) ((o)->op_pmstash) +# define PmopSTASH_set(o,hv) ((o)->op_pmstash = (hv)) +# define PmopSTASHPV(o) (PmopSTASH(o) ? HvNAME(PmopSTASH(o)) : Nullch) + /* op_pmstash is not refcounted */ +# define PmopSTASHPV_set(o,pv) PmopSTASH_set((o), gv_stashpv(pv,GV_ADD)) +#endif + struct svop { BASEOP SV * op_sv; diff --git a/t/op/pat.t b/t/op/pat.t index 293e748..4ba9919 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -70,24 +70,23 @@ $* = 1; # test 3 only tested the optimized version--this one is for real if ("ab\ncd\n" =~ /^cd/) {print "ok 24\n";} else {print "not ok 24\n";} $* = 0; -#$XXX{123} = 123; -#$XXX{234} = 234; -#$XXX{345} = 345; -# -#@XXX = ('ok 25','not ok 25', 'ok 26','not ok 26','not ok 27'); -#while ($_ = shift(@XXX)) { -# ?(.*)? && (print $1,"\n"); -# /not/ && reset; -# /not ok 26/ && reset 'X'; -#} -# -#while (($key,$val) = each(%XXX)) { -# print "not ok 27\n"; -# exit; -#} -# -#print "ok 27\n"; -for (25..27) { print "ok $_\n" } +$XXX{123} = 123; +$XXX{234} = 234; +$XXX{345} = 345; + +@XXX = ('ok 25','not ok 25', 'ok 26','not ok 26','not ok 27'); +while ($_ = shift(@XXX)) { + ?(.*)? && (print $1,"\n"); + /not/ && reset; + /not ok 26/ && reset 'X'; +} + +while (($key,$val) = each(%XXX)) { + print "not ok 27\n"; + exit; +} + +print "ok 27\n"; 'cde' =~ /[^ab]*/; 'xyz' =~ //;