[cfe-commits] [libcxx] r172542 - /libcxx/trunk/include/ostream

Howard Hinnant hhinnant at apple.com
Tue Jan 15 09:22:03 PST 2013


Author: hhinnant
Date: Tue Jan 15 11:22:03 2013
New Revision: 172542

URL: http://llvm.org/viewvc/llvm-project?rev=172542&view=rev
Log:
Optimize basic_ostream::write by having it call sputn instead of sputc.

Modified:
    libcxx/trunk/include/ostream

Modified: libcxx/trunk/include/ostream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ostream?rev=172542&r1=172541&r2=172542&view=diff
==============================================================================
--- libcxx/trunk/include/ostream (original)
+++ libcxx/trunk/include/ostream Tue Jan 15 11:22:03 2013
@@ -1100,17 +1100,8 @@
         sentry __sen(*this);
         if (__sen && __n)
         {
-            typedef ostreambuf_iterator<_CharT, _Traits> _Op;
-            _Op __o(*this);
-            for (; __n; --__n, ++__o, ++__s)
-            {
-                *__o = *__s;
-                if (__o.failed())
-                {
-                    this->setstate(ios_base::badbit);
-                    break;
-                }
-            }
+            if (this->rdbuf()->sputn(__s, __n) != __n)
+                this->setstate(ios_base::badbit);
         }
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }





More information about the cfe-commits mailing list