diff options
author | Karl Williamson <public@khwilliamson.com> | 2010-11-27 15:19:31 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-11-28 04:49:15 -0800 |
commit | 873813865d3bbe2cabafb831683ea56920e540d0 (patch) | |
tree | 876b342d95e9d448fe138e9237a8ced43fda09cf /regexec.c | |
parent | 9dcbe121586cbfc2982c3fef4c17842e23343f68 (diff) | |
download | perl-873813865d3bbe2cabafb831683ea56920e540d0.tar.gz |
regexec.c: pull array lookup out of loop
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 25 |
1 files changed, 9 insertions, 16 deletions
@@ -5836,28 +5836,21 @@ S_regrepeat(pTHX_ const regexp *prog, const regnode *p, I32 max, int depth) * deferred */ } else { + U8 folded; /* Here, the string isn't utf8 and c is a single byte; and either * the pattern isn't utf8 or c is an invariant, so its utf8ness * doesn't affect c. Can just do simple comparisons for exact or * fold matching. */ switch (OP(p)) { - case EXACTF: - while (scan < loceol && - (UCHARAT(scan) == c || UCHARAT(scan) == PL_fold[c])) - { - scan++; - } - break; - case EXACTFL: - while (scan < loceol && - (UCHARAT(scan) == c || UCHARAT(scan) == PL_fold_locale[c])) - { - scan++; - } - break; - default: - Perl_croak(aTHX_ "panic: Unexpected op %u", OP(p)); + case EXACTF: folded = PL_fold[c]; break; + case EXACTFL: folded = PL_fold_locale[c]; break; + default: Perl_croak(aTHX_ "panic: Unexpected op %u", OP(p)); + } + while (scan < loceol && + (UCHARAT(scan) == c || UCHARAT(scan) == folded)) + { + scan++; } } break; |