in is_utf8_string().
p4raw-id: //depot/perl@8300
STRLEN slen, len;
UV uv, ouv;
- if (u <= 0x7f)
+ if (UTF8_IS_ASCII(u))
return 1;
- if (u >= 0x80 && u <= 0xbf)
+ if (!UTF8_IS_START(u))
return 0;
len = UTF8SKIP(s);
- if (len < 2 || (u >= 0xc0 && u <= 0xfd && s[1] < 0x80))
+ if (len < 2 || !UTF8_IS_CONTINUATION(s[1]))
return 0;
slen = len - 1;
uv = u;
ouv = uv;
while (slen--) {
- if ((*s & 0xc0) != 0x80)
+ if (!UTF8_IS_CONTINUATION(*s))
return 0;
uv = UTF8_ACCUMULATE(uv, *s);
if (uv < ouv)
if (!c)
return FALSE;
x += c;
- if (x > send)
- return FALSE;
}
+ if (x != send)
+ return FALSE;
return TRUE;
}