summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-01-15 17:22:03 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-01-15 17:22:03 +0000
commit3d7eb2f80653d8b84760adf96281203ca41c7a88 (patch)
tree982bd8213e21d0c9005bab98300b6a2107efd695 /libcxx/include
parent701d2b861e4db4123a9a4e2f1bb07b66a6a8753d (diff)
downloadbcm5719-llvm-3d7eb2f80653d8b84760adf96281203ca41c7a88.tar.gz
bcm5719-llvm-3d7eb2f80653d8b84760adf96281203ca41c7a88.zip
Optimize basic_ostream::write by having it call sputn instead of sputc.
llvm-svn: 172542
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/ostream13
1 files changed, 2 insertions, 11 deletions
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index 9d26a41e829..b3b6df573d0 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -1100,17 +1100,8 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
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
}
OpenPOWER on IntegriCloud