From: Artur Bergman Date: Thu, 30 Aug 2001 08:22:31 +0000 (+0000) Subject: Introduces SvREPADTMP(sv) that marks a repad SvIV as a offset X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1cc8b4c566f7901a54e4b576f09608beb4c81f86;p=p5sagit%2Fp5-mst-13.2.git Introduces SvREPADTMP(sv) that marks a repad SvIV as a offset on the pad. Fixes coredumps in cleanups introduced by Change 11755 p4raw-id: //depot/perl@11790 --- diff --git a/op.c b/op.c index f773ba7..b19abea 100644 --- a/op.c +++ b/op.c @@ -864,6 +864,7 @@ clear_pmop: #ifdef USE_ITHREADS if(PL_regex_pad) { /* We could be in destruction */ av_push((AV*) PL_regex_pad[0],(SV*) PL_regex_pad[(cPMOPo)->op_pmoffset]); + SvREPADTMP_on(PL_regex_pad[(cPMOPo)->op_pmoffset]); PM_SETRE(cPMOPo, (cPMOPo)->op_pmoffset); } #endif @@ -2975,6 +2976,7 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags) if(av_len((AV*) PL_regex_pad[0]) > -1) { repointer = av_pop((AV*)PL_regex_pad[0]); pmop->op_pmoffset = SvIV(repointer); + SvREPADTMP_off(repointer); sv_setiv(repointer,0); } else { repointer = newSViv(0); diff --git a/perl.c b/perl.c index 51cb927..820f65d 100644 --- a/perl.c +++ b/perl.c @@ -496,7 +496,10 @@ perl_destruct(pTHXx) * flag is set in regexec.c:S_regtry */ SvFLAGS(resv) &= ~SVf_BREAK; - } + } + else if(SvREPADTMP(resv)) { + SvREPADTMP_off(resv); + } else { ReREFCNT_dec(re); } diff --git a/sv.h b/sv.h index bb18b0e..fabf7fd 100644 --- a/sv.h +++ b/sv.h @@ -703,6 +703,14 @@ and leaves the UTF8 status as it was. #define SvVALID_on(sv) (SvFLAGS(sv) |= SVpbm_VALID) #define SvVALID_off(sv) (SvFLAGS(sv) &= ~SVpbm_VALID) +#ifdef USE_ITHREADS +/* The following uses the FAKE flag to show that a regex pointer is infact + it's own offset in the regexpad for ithreads */ +#define SvREPADTMP(sv) (SvFLAGS(sv) & SVf_FAKE) +#define SvREPADTMP_on(sv) (SvFLAGS(sv) |= SVf_FAKE) +#define SvREPADTMP_off(sv) (SvFLAGS(sv) &= ~SVf_FAKE) +#endif + #define SvRV(sv) ((XRV*) SvANY(sv))->xrv_rv #define SvRVx(sv) SvRV(sv)