Optimize basic_ostream::write by having it call sputn instead of sputc.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172542 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b05a55675f
commit
0b93963db7
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user