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++)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to