diff options
author | Ævar Arnfjörð Bjarmason <avar@cpan.org> | 2007-08-09 07:49:16 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-08-09 10:10:37 +0000 |
commit | 640f820da331e7bc688f3f8820b2760fa5a09de6 (patch) | |
tree | cb0dcb9ac4b8e2fc5c49fcd2c6db441d7469a37c /regcomp.c | |
parent | d3bf4b0e5207a91e509350df0ebcce4b2c9908f0 (diff) | |
download | perl-640f820da331e7bc688f3f8820b2760fa5a09de6.tar.gz |
Optimize split //
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Message-ID: <51dd1af80708090049p2cf4810ep5a437ad53f64fa78@mail.gmail.com>
p4raw-id: //depot/perl@31693
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -4753,6 +4753,8 @@ reStudy: r->paren_names = NULL; #ifdef STUPID_PATTERN_CHECKS + if (r->prelen == 0) + r->extflags |= RXf_NULL; if (r->extflags & RXf_SPLIT && r->prelen == 1 && r->precomp[0] == ' ') /* XXX: this should happen BEFORE we compile */ r->extflags |= (RXf_SKIPWHITE|RXf_WHITE); @@ -4769,7 +4771,9 @@ reStudy: U8 fop = OP(first); U8 nop = OP(NEXTOPER(first)); - if (PL_regkind[fop] == BOL && nop == END) + if (PL_regkind[fop] == NOTHING && nop == END) + r->extflags |= RXf_NULL; + else if (PL_regkind[fop] == BOL && nop == END) r->extflags |= RXf_START_ONLY; else if (fop == PLUS && nop ==SPACE && OP(regnext(first))==END) r->extflags |= RXf_WHITE; |