summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avar@cpan.org>2007-06-28 20:06:50 +0000
committerYves Orton <demerphq@gmail.com>2007-06-28 22:09:07 +0000
commit0ac6acaed7c2092a5668c6b70ddeaf3003e989d8 (patch)
treeb180dc08771b7c5e7480dd8f7ae97cec29d279a2 /regcomp.c
parent0df5f63f6809bbf24ffde62fa2804f0041470b74 (diff)
downloadperl-0ac6acaed7c2092a5668c6b70ddeaf3003e989d8.tar.gz
Move the RXf_WHITE logic for split " " into the regex engine
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com> Message-ID: <51dd1af80706281306i4dbba39em3eeb8da1d67ea27c@mail.gmail.com> (with tweaks) p4raw-id: //depot/perl@31495
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index 4e146b7cbd..d7b99814d6 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4751,8 +4751,12 @@ reStudy:
r->paren_names = (HV*)SvREFCNT_inc(RExC_paren_names);
else
r->paren_names = NULL;
- if (r->prelen == 3 && strnEQ("\\s+", r->precomp, 3)) /* precomp = "\\s+)" */
- r->extflags |= RXf_WHITE;
+
+ if (r->extflags & RXf_SPLIT && r->prelen == 1 && r->precomp[0] == ' ')
+ /* XXX: this should happen BEFORE we compile */
+ r->extflags |= (RXf_SKIPWHITE|RXf_WHITE);
+ else if (r->prelen == 3 && memEQ("\\s+", r->precomp, 3))
+ r->extflags |= RXf_WHITE;
else if (r->prelen == 1 && r->precomp[0] == '^')
r->extflags |= RXf_START_ONLY;