svn commit: r304811 - head/lib/libc/stdio
Andrey A. Chernov
ache at FreeBSD.org
Thu Aug 25 17:30:02 UTC 2016
Author: ache
Date: Thu Aug 25 17:30:00 2016
New Revision: 304811
URL: https://svnweb.freebsd.org/changeset/base/304811
Log:
Remove "Fast path", it bypass __wcrtomb() and all its error checking.
One of affected encoding example: US-ASCII
MFC after: 7 days
Modified:
head/lib/libc/stdio/fputwc.c
Modified: head/lib/libc/stdio/fputwc.c
==============================================================================
--- head/lib/libc/stdio/fputwc.c Thu Aug 25 17:13:04 2016 (r304810)
+++ head/lib/libc/stdio/fputwc.c Thu Aug 25 17:30:00 2016 (r304811)
@@ -53,19 +53,9 @@ __fputwc(wchar_t wc, FILE *fp, locale_t
size_t i, len;
struct xlocale_ctype *l = XLOCALE_CTYPE(locale);
- if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) {
- /*
- * Assume single-byte locale with no special encoding.
- * A more careful test would be to check
- * _CurrentRuneLocale->encoding.
- */
- *buf = (unsigned char)wc;
- len = 1;
- } else {
- if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) {
- fp->_flags |= __SERR;
- return (WEOF);
- }
+ if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) {
+ fp->_flags |= __SERR;
+ return (WEOF);
}
for (i = 0; i < len; i++)
More information about the svn-src-head
mailing list