utf: ensure neat() is called in utf8_check
This commit is contained in:
parent
9b191d9b9a
commit
0ecf0be554
1 changed files with 8 additions and 2 deletions
|
@ -17,7 +17,7 @@
|
|||
usize utf8_check(const char *restrict s, error *err)
|
||||
{
|
||||
usize ret = 0;
|
||||
nchar c;
|
||||
nchar c = 0xffffffff; /* not a valid Unicode character */
|
||||
|
||||
while (*s != '\0') {
|
||||
ret++;
|
||||
|
@ -27,13 +27,16 @@ usize utf8_check(const char *restrict s, error *err)
|
|||
}
|
||||
}
|
||||
|
||||
if (c == 0xffffffff) /* loop hasn't executed at all */
|
||||
neat(err);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
usize utf8_ncheck(const char *restrict s, usize maxsize, error *err)
|
||||
{
|
||||
usize ret = 0;
|
||||
nchar c;
|
||||
nchar c = 0xffffffff; /* not a valid Unicode character */
|
||||
|
||||
while (*s != '\0' && maxsize != 0) {
|
||||
ret++;
|
||||
|
@ -45,6 +48,9 @@ usize utf8_ncheck(const char *restrict s, usize maxsize, error *err)
|
|||
}
|
||||
}
|
||||
|
||||
if (c == 0xffffffff) /* loop hasn't executed at all */
|
||||
neat(err);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue