From: Andy Lester Date: Thu, 11 May 2006 22:41:01 +0000 (-0500) Subject: Speed up utf8.c a bit X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3ebfea2846d81f58e86dfcb7f9e09300e5dfcd17;p=p5sagit%2Fp5-mst-13.2.git Speed up utf8.c a bit Message-ID: <20060512034101.GA10709@petdance.com> p4raw-id: //depot/perl@28176 --- diff --git a/utf8.c b/utf8.c index d0cbb4e..dad7920 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); } /*