From: Martin Mares Date: Fri, 14 Jun 2002 23:52:33 +0000 (+0000) Subject: Added a macro UTF8_SKIP for skipping a UTF-8 character without decoding it. X-Git-Tag: holmes-import~1398 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=fd853deb849f5b72004d4ed4d48b591dc5d50356;p=libucw.git Added a macro UTF8_SKIP for skipping a UTF-8 character without decoding it. --- diff --git a/charset/unicode.h b/charset/unicode.h index 50d4ed77..f12fff1a 100644 --- a/charset/unicode.h +++ b/charset/unicode.h @@ -102,6 +102,12 @@ static inline word Uunaccent(word x) else \ u = *p++ +#define UTF8_SKIP(p) do { \ + if (*p++ >= 0xc0) \ + while (*p >= 0x80 && *p < 0xc0) \ + p++; \ + } while (0) + #define UTF8_SPACE(u) ((u) < 0x80 ? 1 : (u) < 0x800 ? 2 : 3) uns ucs2_to_utf8(byte *, word *);