utf8.c: Remove an unnecessary conditional
authorKarl Williamson <public@khwilliamson.com>
Sat, 6 Oct 2012 21:08:19 +0000 (15:08 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 9 Oct 2012 17:16:06 +0000 (11:16 -0600)
The unconditional array lookup is clearer, and I suspect faster than
testing for a special case.

utf8.c

diff --git a/utf8.c b/utf8.c
index 6600023..13fb689 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -1096,10 +1096,7 @@ Perl_utf8_length(pTHX_ const U8 *s, const U8 *e)
     if (e < s)
        goto warn_and_return;
     while (s < e) {
-       if (!UTF8_IS_INVARIANT(*s))
-           s += UTF8SKIP(s);
-       else
-           s++;
+        s += UTF8SKIP(s);
        len++;
     }