From: Malcolm Beattie Date: Wed, 19 Nov 1997 17:45:37 +0000 (+0000) Subject: The new jumbo regexp stuff did SSPUSHINT on a char* instead of X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c5254dd600e35509100e643867b417e514781043;p=p5sagit%2Fp5-mst-13.2.git The new jumbo regexp stuff did SSPUSHINT on a char* instead of SSPUSHPTR causing Alpha to core dump in pat.t. While fixing it, also fixed two instances of referring to SVs after destruction. p4raw-id: //depot/perl@270 --- diff --git a/regcomp.c b/regcomp.c index 6489b78..603a421 100644 --- a/regcomp.c +++ b/regcomp.c @@ -815,6 +815,7 @@ pregcomp(char *exp, char *xend, PMOP *pm) if (OP(scan) != BRANCH) { /* Only one top-level choice. */ scan_data_t data; I32 fake; + STRLEN longest_float_length, longest_fixed_length; StructCopy(&zero_scan_data, &data, scan_data_t); first = scan; @@ -893,7 +894,8 @@ pregcomp(char *exp, char *xend, PMOP *pm) scan_commit(&data); SvREFCNT_dec(data.last_found); - if (SvCUR(data.longest_float) + longest_float_length = SvCUR(data.longest_float); + if (longest_float_length || (data.flags & SF_FL_BEFORE_EOL && (!(data.flags & SF_FL_BEFORE_MEOL) || (regflags & PMf_MULTILINE)))) { @@ -914,9 +916,11 @@ pregcomp(char *exp, char *xend, PMOP *pm) remove: r->float_substr = Nullsv; SvREFCNT_dec(data.longest_float); + longest_float_length = 0; } - if (SvCUR(data.longest_fixed) + longest_fixed_length = SvCUR(data.longest_fixed); + if (longest_fixed_length || (data.flags & SF_FIX_BEFORE_EOL /* Cannot have SEOL and MULTI */ && (!(data.flags & SF_FIX_BEFORE_MEOL) || (regflags & PMf_MULTILINE)))) { @@ -931,10 +935,11 @@ pregcomp(char *exp, char *xend, PMOP *pm) } else { r->anchored_substr = Nullsv; SvREFCNT_dec(data.longest_fixed); + longest_fixed_length = 0; } /* A temporary algorithm prefers floated substr to fixed one to dig more info. */ - if (SvCUR(data.longest_fixed) > SvCUR(data.longest_float)) { + if (longest_fixed_length > longest_float_length) { r->check_substr = r->anchored_substr; r->check_offset_min = r->check_offset_max = r->anchored_offset; if (r->reganch & ROPT_ANCH_SINGLE) diff --git a/regexec.c b/regexec.c index d74c234..fb811d2 100644 --- a/regexec.c +++ b/regexec.c @@ -130,7 +130,7 @@ regcppush(I32 parenfloor) for (p = regsize; p > parenfloor; p--) { SSPUSHPTR(regendp[p]); SSPUSHPTR(regstartp[p]); - SSPUSHINT(reg_start_tmp[p]); + SSPUSHPTR(reg_start_tmp[p]); SSPUSHINT(p); } SSPUSHINT(regsize);