diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-07-01 14:14:37 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-07-01 14:14:37 +0000 |
commit | 1acdb0da20c8b57ef4b35c7c1b7e0ed3fc417368 (patch) | |
tree | 44aac2ab1ba54415185ddfae6729dc7b8081a138 /utf8.c | |
parent | d103360b8581685282078776ac5692a3521f9a95 (diff) | |
download | perl-1acdb0da20c8b57ef4b35c7c1b7e0ed3fc417368.tar.gz |
Small speedup by inlining the easy bits of is_utf8_char()
into is_utf8_string().
p4raw-id: //depot/perl@17392
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -237,9 +237,17 @@ Perl_is_utf8_string(pTHX_ U8 *s, STRLEN len) send = s + len; while (x < send) { - c = is_utf8_char(x); - if (!c) - return FALSE; + /* Inline the easy bits of is_utf8_char() here for speed... */ + if (UTF8_IS_INVARIANT(*x)) + c = 1; + else if (!UTF8_IS_START(*x)) + return FALSE; + else { + /* ... and call is_utf8_char() only if really needed. */ + c = is_utf8_char(x); + if (!c) + return FALSE; + } x += c; } if (x != send) |