X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/6c9570dc5de7137a22f5d4e76431529d4f7342b7..8727f688bf9bab57862da9dd9073020b13c82940:/pp.c diff --git a/pp.c b/pp.c index 645ba62..4b021c0 100644 --- a/pp.c +++ b/pp.c @@ -1,7 +1,7 @@ /* pp.c * * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others + * 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -4035,7 +4035,7 @@ PP(pp_hslice) if (lval) { if (!svp || *svp == &PL_sv_undef) { - DIE(aTHX_ PL_no_helem_sv, (void*)keysv); + DIE(aTHX_ PL_no_helem_sv, SVfARG(keysv)); } if (localizing) { if (HvNAME_get(hv) && isGV(*svp)) @@ -4606,12 +4606,29 @@ PP(pp_split) if (!limit) limit = maxiters + 2; if (pm->op_pmflags & PMf_WHITE) { + if (do_utf8 && !PL_utf8_space) { + /* force PL_utf8_space to be loaded */ + bool ok; + ENTER; + ok = is_utf8_space((const U8*)" "); + assert(ok); + LEAVE; + } while (--limit) { m = s; - while (m < strend && - !((pm->op_pmflags & PMf_LOCALE) - ? isSPACE_LC(*m) : isSPACE(*m))) - ++m; + /* this one uses 'm' and is a negative test */ + if (do_utf8) { + STRLEN uskip; + while (m < strend && + !( *m == ' ' || swash_fetch(PL_utf8_space,(U8*)m, do_utf8) )) + m += UTF8SKIP(m); + } else if (pm->op_pmflags & PMf_LOCALE) { + while (m < strend && !isSPACE_LC(*m)) + ++m; + } else { + while (m < strend && !isSPACE(*m)) + ++m; + } if (m >= strend) break; @@ -4623,13 +4640,21 @@ PP(pp_split) XPUSHs(dstr); s = m + 1; - while (s < strend && - ((pm->op_pmflags & PMf_LOCALE) - ? isSPACE_LC(*s) : isSPACE(*s))) - ++s; + /* this one uses 's' and is a positive test */ + if (do_utf8) { + while (s < strend && + ( *s == ' ' || swash_fetch(PL_utf8_space,(U8*)s, do_utf8) )) + s += UTF8SKIP(s); + } else if (pm->op_pmflags & PMf_LOCALE) { + while (s < strend && isSPACE_LC(*s)) + ++s; + } else { + while (s < strend && isSPACE(*s)) + ++s; + } } } - else if (rx->precomp[0] == '^' && rx->precomp[1] == '\0') { + else if (rx->extflags & RXf_START_ONLY) { while (--limit) { for (m = s; m < strend && *m != '\n'; m++) ;