diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-01-30 17:34:11 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-01-30 17:34:11 +0000 |
commit | d8cbf1d0e84793db7092cc0c6a81966522a74f71 (patch) | |
tree | 5a77923e75dcf1df9beb2164ae3ccff8bdf90d8e /pp.c | |
parent | f9e2c6803c429b974c6b529ddf770b54f24be2be (diff) | |
download | perl-d8cbf1d0e84793db7092cc0c6a81966522a74f71.tar.gz |
Integrate:
[ 32753]
Wrap all accesses to the members precomp and prelen of struct regexp in
the macros RX_PRECOMP() and RX_PRELEN(). This will allow us to reduce
the regexp storage overhead by computing them at retrieve time.
[ 32756]
Replace 3 uses of RX_PRELEN(r) with plen, which has the same value.
(But isn't a pointer dereference. Or about to become a calculation.)
[ 32758]
Wrap wrapped and wraplen from struct regexp in macros RW_WRAPPED() and
RX_WRAPLEN() to preserve source compatibility when they get moved
around.
[ 32774]
The position of the modifier flag bits is actually encoded by a right
shift 12 in two places, so replace that magic number with a macro
RXf_PMf_STD_PMMOD_SHIFT defined adjacent to the flags it interacts
with.
[ 32802]
Wrap all deferences of struct regexp* in macros RX_*() [and for
regcomp.c and regexec.c RXp_* where necessary] so that in future we
can maintain source compatibility when we add an extra level of
dereferencing.
p4raw-link: @32802 on //depot/perl: 07bc277f32c1d7aff237dd3f55d558b5d4b93314
p4raw-link: @32774 on //depot/perl: 14f3b9f2b06052c35a95062569fb2799771d1e2b
p4raw-link: @32758 on //depot/perl: 866c78d1cf6feeffe34601c244c137d8b30ec2e4
p4raw-link: @32756 on //depot/perl: bb661a585caf67142a296faaea725681ffc2a2ac
p4raw-link: @32753 on //depot/perl: 220fc49f9cd19ab777a22ef733671f0fbb81e6bd
p4raw-id: //depot/maint-5.10/perl@33130
p4raw-integrated: from //depot/perl@32802 'copy in' regcomp.h
(@32793..) 'edit in' regexec.c (@32753..) 'merge in' pp.c
(@32760..) mg.c (@32789..) perl.h (@32793..)
p4raw-integrated: from //depot/perl@32774 'edit in' regcomp.c
(@32758..) regexp.h (@32759..)
p4raw-integrated: from //depot/perl@32758 'edit in' dump.c ext/re/re.xs
(@32753..)
p4raw-integrated: from //depot/perl@32753 'edit in' op.c (@32680..)
pp_ctl.c pp_hot.c (@32751..) 'ignore' ext/B/B.xs (@32751..)
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -4614,8 +4614,8 @@ PP(pp_split) DIE(aTHX_ "panic: pp_split"); rx = PM_GETRE(pm); - TAINT_IF((rx->extflags & RXf_PMf_LOCALE) && - (rx->extflags & (RXf_WHITE | RXf_SKIPWHITE))); + TAINT_IF((RX_EXTFLAGS(rx) & RXf_PMf_LOCALE) && + (RX_EXTFLAGS(rx) & (RXf_WHITE | RXf_SKIPWHITE))); RX_MATCH_UTF8_set(rx, do_utf8); @@ -4657,12 +4657,12 @@ PP(pp_split) } base = SP - PL_stack_base; orig = s; - if (rx->extflags & RXf_SKIPWHITE) { + if (RX_EXTFLAGS(rx) & RXf_SKIPWHITE) { if (do_utf8) { while (*s == ' ' || is_utf8_space((U8*)s)) s += UTF8SKIP(s); } - else if (rx->extflags & RXf_PMf_LOCALE) { + else if (RX_EXTFLAGS(rx) & RXf_PMf_LOCALE) { while (isSPACE_LC(*s)) s++; } @@ -4671,13 +4671,13 @@ PP(pp_split) s++; } } - if (rx->extflags & PMf_MULTILINE) { + if (RX_EXTFLAGS(rx) & PMf_MULTILINE) { multiline = 1; } if (!limit) limit = maxiters + 2; - if (rx->extflags & RXf_WHITE) { + if (RX_EXTFLAGS(rx) & RXf_WHITE) { while (--limit) { m = s; /* this one uses 'm' and is a negative test */ @@ -4690,7 +4690,7 @@ PP(pp_split) else m += t; } - } else if (rx->extflags & RXf_PMf_LOCALE) { + } else if (RX_EXTFLAGS(rx) & RXf_PMf_LOCALE) { while (m < strend && !isSPACE_LC(*m)) ++m; } else { @@ -4717,7 +4717,7 @@ PP(pp_split) if (do_utf8) { while (s < strend && ( *s == ' ' || is_utf8_space((U8*)s) )) s += UTF8SKIP(s); - } else if (rx->extflags & RXf_PMf_LOCALE) { + } else if (RX_EXTFLAGS(rx) & RXf_PMf_LOCALE) { while (s < strend && isSPACE_LC(*s)) ++s; } else { @@ -4726,7 +4726,7 @@ PP(pp_split) } } } - else if (rx->extflags & RXf_START_ONLY) { + else if (RX_EXTFLAGS(rx) & RXf_START_ONLY) { while (--limit) { for (m = s; m < strend && *m != '\n'; m++) ; @@ -4742,7 +4742,7 @@ PP(pp_split) s = m; } } - else if (rx->extflags & RXf_NULL && !(s >= strend)) { + else if (RX_EXTFLAGS(rx) & RXf_NULL && !(s >= strend)) { /* Pre-extend the stack, either the number of bytes or characters in the string or a limited amount, triggered by: @@ -4789,15 +4789,15 @@ PP(pp_split) } } } - else if (do_utf8 == ((rx->extflags & RXf_UTF8) != 0) && - (rx->extflags & RXf_USE_INTUIT) && !rx->nparens - && (rx->extflags & RXf_CHECK_ALL) - && !(rx->extflags & RXf_ANCH)) { - const int tail = (rx->extflags & RXf_INTUIT_TAIL); + else if (do_utf8 == ((RX_EXTFLAGS(rx) & RXf_UTF8) != 0) && + (RX_EXTFLAGS(rx) & RXf_USE_INTUIT) && !RX_NPARENS(rx) + && (RX_EXTFLAGS(rx) & RXf_CHECK_ALL) + && !(RX_EXTFLAGS(rx) & RXf_ANCH)) { + const int tail = (RX_EXTFLAGS(rx) & RXf_INTUIT_TAIL); SV * const csv = CALLREG_INTUIT_STRING(rx); - len = rx->minlenret; - if (len == 1 && !(rx->extflags & RXf_UTF8) && !tail) { + len = RX_MINLENRET(rx); + if (len == 1 && !(RX_EXTFLAGS(rx) & RXf_UTF8) && !tail) { const char c = *SvPV_nolen_const(csv); while (--limit) { for (m = s; m < strend && *m != c; m++) @@ -4839,7 +4839,7 @@ PP(pp_split) } } else { - maxiters += slen * rx->nparens; + maxiters += slen * RX_NPARENS(rx); while (s < strend && --limit) { I32 rex_return; @@ -4850,25 +4850,25 @@ PP(pp_split) if (rex_return == 0) break; TAINT_IF(RX_MATCH_TAINTED(rx)); - if (RX_MATCH_COPIED(rx) && rx->subbeg != orig) { + if (RX_MATCH_COPIED(rx) && RX_SUBBEG(rx) != orig) { m = s; s = orig; - orig = rx->subbeg; + orig = RX_SUBBEG(rx); s = orig + (m - s); strend = s + (strend - m); } - m = rx->offs[0].start + orig; + m = RX_OFFS(rx)[0].start + orig; dstr = newSVpvn(s, m-s); if (make_mortal) sv_2mortal(dstr); if (do_utf8) (void)SvUTF8_on(dstr); XPUSHs(dstr); - if (rx->nparens) { + if (RX_NPARENS(rx)) { I32 i; - for (i = 1; i <= (I32)rx->nparens; i++) { - s = rx->offs[i].start + orig; - m = rx->offs[i].end + orig; + for (i = 1; i <= (I32)RX_NPARENS(rx); i++) { + s = RX_OFFS(rx)[i].start + orig; + m = RX_OFFS(rx)[i].end + orig; /* japhy (07/27/01) -- the (m && s) test doesn't catch parens that didn't match -- they should be set to @@ -4885,7 +4885,7 @@ PP(pp_split) XPUSHs(dstr); } } - s = rx->offs[0].end + orig; + s = RX_OFFS(rx)[0].end + orig; } } |