Date: Thu, 25 Aug 2016 17:30:01 +0000 (UTC) From: "Andrey A. Chernov" <ache@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304811 - head/lib/libc/stdio Message-ID: <201608251730.u7PHU1uQ074253@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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++)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608251730.u7PHU1uQ074253>