summaryrefslogtreecommitdiff
path: root/op.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 /op.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 'op.c')
-rw-r--r--op.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/op.c b/op.c
index 613cc2e74e..cdd7aaf3c3 100644
--- a/op.c
+++ b/op.c
@@ -3424,32 +3424,15 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg)
pm = (PMOP*)o;
if (expr->op_type == OP_CONST) {
- STRLEN plen;
SV * const pat = ((SVOP*)expr)->op_sv;
- const char *p = SvPV_const(pat, plen);
U32 pm_flags = pm->op_pmflags & PMf_COMPILETIME;
- if ((o->op_flags & OPf_SPECIAL) && (plen == 1 && *p == ' ')) {
- U32 was_readonly = SvREADONLY(pat);
- if (was_readonly) {
- if (SvFAKE(pat)) {
- sv_force_normal_flags(pat, 0);
- assert(!SvREADONLY(pat));
- was_readonly = 0;
- } else {
- SvREADONLY_off(pat);
- }
- }
+ if (o->op_flags & OPf_SPECIAL)
+ pm_flags |= RXf_SPLIT;
- sv_setpvn(pat, "\\s+", 3);
-
- SvFLAGS(pat) |= was_readonly;
-
- p = SvPV_const(pat, plen);
- pm_flags |= RXf_SKIPWHITE;
- }
- if (DO_UTF8(pat))
+ if (DO_UTF8(pat))
pm_flags |= RXf_UTF8;
+
PM_SETRE(pm, CALLREGCOMP(pat, pm_flags));
#ifdef PERL_MAD