summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2006-05-11 17:41:01 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-05-12 12:23:03 +0000
commit3ebfea2846d81f58e86dfcb7f9e09300e5dfcd17 (patch)
tree9715a29607224fb3409f22387fd4ed4b0a320881 /utf8.c
parent4789ae7c0cb97d73668d156d061a31899da00712 (diff)
downloadperl-3ebfea2846d81f58e86dfcb7f9e09300e5dfcd17.tar.gz
Speed up utf8.c a bit
Message-ID: <20060512034101.GA10709@petdance.com> p4raw-id: //depot/perl@28176
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/utf8.c b/utf8.c
index d0cbb4eb0b..dad79206ca 100644
--- a/utf8.c
+++ b/utf8.c
@@ -332,13 +332,12 @@ Perl_is_utf8_string_loclen(pTHX_ const U8 *s, STRLEN len, const U8 **ep, STRLEN
const U8* x = s;
const U8* send;
STRLEN c;
+ STRLEN outlen = 0;
PERL_UNUSED_CONTEXT;
if (!len)
len = strlen((const char *)s);
send = s + len;
- if (el)
- *el = 0;
while (x < send) {
/* Inline the easy bits of is_utf8_char() here for speed... */
@@ -362,17 +361,16 @@ Perl_is_utf8_string_loclen(pTHX_ const U8 *s, STRLEN len, const U8 **ep, STRLEN
goto out;
}
x += c;
- if (el)
- (*el)++;
+ outlen++;
}
out:
+ if (el)
+ *el = outlen;
+
if (ep)
*ep = x;
- if (x != send)
- return FALSE;
-
- return TRUE;
+ return (x == send);
}
/*