From 5635c7575119dffacda891b3f59bf3d2b839e455 Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Thu, 19 Jul 2007 13:48:47 +0200 Subject: [PATCH] libucw: removed utf8_check routine... it did not check correct UTF-8 anyway, only a subset --- lib/unicode-utf8.c | 29 ----------------------------- lib/unicode.h | 1 - 2 files changed, 30 deletions(-) diff --git a/lib/unicode-utf8.c b/lib/unicode-utf8.c index a52e553c..e4a33af8 100644 --- a/lib/unicode-utf8.c +++ b/lib/unicode-utf8.c @@ -36,35 +36,6 @@ utf8_strnlen(const byte *str, uns n) return len; } -uns -utf8_check(const byte *s) -{ -#define UTF8_CHECK_NEXT if (unlikely((*s & 0xc0) != 0x80)) goto bad; s++ - while (*s) - { - uns u = *s++; - if (u < 0x80) - ; - else if (unlikely(u < 0xc0)) - { -bad: - return 0; - } - else if (u < 0xe0) - { - UTF8_CHECK_NEXT; - } - else if (likely(u < 0xf0)) - { - UTF8_CHECK_NEXT; - UTF8_CHECK_NEXT; - } - else - goto bad; - } - return 1; -} - #ifdef TEST #include #include diff --git a/lib/unicode.h b/lib/unicode.h index 00256ff4..52ea5e68 100644 --- a/lib/unicode.h +++ b/lib/unicode.h @@ -212,6 +212,5 @@ utf8_encoding_len(uns c) uns utf8_strlen(const byte *str); uns utf8_strnlen(const byte *str, uns n); -uns utf8_check(const byte *str); #endif -- 2.39.2