diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-05-05 10:40:56 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-05-20 11:01:51 -0600 |
commit | b35bbc3f802dc4b4abbbc28ed19bc5108f2b7ef1 (patch) | |
tree | cb04fc4b15414bc6240b921789e6575d1f0269d0 /regcomp.c | |
parent | b9cc4f69dc87bbd21b54bb9a4466203cf97afacc (diff) | |
download | perl-b35bbc3f802dc4b4abbbc28ed19bc5108f2b7ef1.tar.gz |
regcomp.c: Reorder two 'if's so shorter branches are first
This makes it easier to understand what is going on
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 60 |
1 files changed, 32 insertions, 28 deletions
@@ -11029,14 +11029,36 @@ tryagain: goto loopdone; } - if (FOLD) { - if (UTF + if (! FOLD) { + if (UTF) { + const STRLEN unilen = reguni(pRExC_state, ender, s); + if (unilen > 0) { + s += unilen; + len += unilen; + } + + /* The loop increments <len> each time, as all but this + * path (and one other) through it add a single byte to + * the EXACTish node. But this one has changed len to + * be the correct final value, so subtract one to + * cancel out the increment that follows */ + len--; + } + else { + REGC((char)ender, s++); + } + } + else { /* FOLD */ + if (! ( UTF /* See comments for join_exact() as to why we fold * this non-UTF at compile time */ - || (node_type == EXACTFU - && ender == LATIN_SMALL_LETTER_SHARP_S)) + || (node_type == EXACTFU + && ender == LATIN_SMALL_LETTER_SHARP_S))) { - + *(s++) = (char) ender; + maybe_exact &= ! IS_IN_SOME_FOLD_L1(ender); + } + else { /* Prime the casefolded buffer. Locale rules, which * apply only to code points < 256, aren't known until @@ -11095,32 +11117,14 @@ tryagain: } s += foldlen; - /* The loop increments <len> each time, as all but this - * path (and the one just below for UTF) through it add - * a single byte to the EXACTish node. But this one - * has changed len to be the correct final value, so - * subtract one to cancel out the increment that - * follows */ + /* The loop increments <len> each time, as all but this + * path (and one other) through it add a single byte to + * the EXACTish node. But this one has changed len to + * be the correct final value, so subtract one to + * cancel out the increment that follows */ len += foldlen - 1; } - else { - *(s++) = (char) ender; - maybe_exact &= ! IS_IN_SOME_FOLD_L1(ender); - } } - else if (UTF) { - const STRLEN unilen = reguni(pRExC_state, ender, s); - if (unilen > 0) { - s += unilen; - len += unilen; - } - - /* See comment just above for - 1 */ - len--; - } - else { - REGC((char)ender, s++); - } if (next_is_quantifier) { |