_mbtowc_r with direct call to __mbtowc.
* libc/stdio/vfscanf.c: Ditto.
* libc/stdlib/btowc.c: Include local.h. Replace call to _mbtowc_r
with direct call to __mbtowc.
* libc/stdlib/mblen.c: Ditto.
* libc/stdlib/mblen_r.c: Ditto.
* libc/stdlib/mbrtowc.c: Ditto.
* libc/stdlib/mbstowcs_r.c: Ditto.
* libc/stdlib/mbtowc.c: Ditto.
* libc/stdlib/wcrtomb.c: Include local.h. Replace call to _wctomb_r
with direct call to __wctomb.
* libc/stdlib/wcsnrtombs.c: Ditto.
(_wcsnrtombs_r): Ditto.
* libc/stdlib/wcstombs_r.c: Ditto.
* libc/stdlib/wctob.c: Ditto.
* libc/stdlib/wctomb.c: Ditto.
* libc/stdlib/mbrtowc.c (mbrtowc): Implement independently from
_mbrtowc_r, unless PREFER_SIZE_OVER_SPEED or __OPTIMIZE_SIZE__ are
defined.
* libc/stdlib/wcrtomb.c (wcrtomb): Implement independently from
_wcrtomb_r, unless PREFER_SIZE_OVER_SPEED or __OPTIMIZE_SIZE__ are
defined.
* libc/stdlib/mbtowc_r.c (__utf8_mbtowc): Drop unnecessary test for
ch >= 0.
* libc/stdlib/mbrtowc.c (_mbrtowc_r): Fix case where s is null
pointer to match C99 spec.
* libc/stdlib/mbsrtowcs.c (_mbsrtowc_r): Fix to ignore len when
dst is NULL. Also fix to not alter src pointer when dst is NULL
and call _mbrtowc_r instead of _mbtowc_r.
* libc/stdlib/wcsrtombs.c (_wcsrtombs_r): Call _wcrtomb_r instead
of _wctomb_r.
* libc/include/sys/_types.h (_mbstate_t): Changed to use
unsigned char internally.
* libc/sys/linux/sys/_types.h: Ditto.
* libc/include/sys/reent.h
* libc/stdlib/mblen.c (mblen): Use function-specific state
value from default reentrancy structure.
* libc/stdlib/mblen_r.c (_mblen_r): If return code from
_mbtowc_r is less than 0, reset state __count value and
return -1.
* libc/stdlib/mbrlen.c (mbrlen): If the input state pointer
is NULL, use the function-specific pointer provided in the
default reentrancy structure.
* libc/stdlib/mbrtowc.c: Add reentrant form of function.
If input state pointer is NULL, use function-specific area
provided in reentrancy structure.
* libc/stdlib/mbsrtowcs.c: Ditto.
* libc/stdlib/wcrtomb.c: Ditto.
* libc/stdlib/wcsrtombs.c: Ditto.
* libc/stdlib/mbstowcs.c: Reformat.
* libc/stdlib/wcstombs.c: Ditto.
* libc/stdlib/mbstowcs_r.c (_mbstowcs_r): If an error occurs,
reset the state's __count value and return -1.
* libc/stdlib/mbtowc.c: Ditto.
* libc/stdlib/mbtowc_r.c (_mbtowc_r): Add restartable functionality.
If number of bytes is used up before completing a valid multibyte
character, return -2 and save the state.
* libc/stdlib/wctomb_r.c (_wctomb_r): Define __state as __count
and change some __count references to __state for clarity.