From 873813865d3bbe2cabafb831683ea56920e540d0 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 27 Nov 2010 15:19:31 -0700 Subject: [PATCH] regexec.c: pull array lookup out of loop --- regexec.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/regexec.c b/regexec.c index 7dadc02..5586107 100644 --- a/regexec.c +++ b/regexec.c @@ -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; -- 1.8.3.1