mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 20:29:39 +08:00
Don't call memmove when there's nothing to move. Fixes PR#27978.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271794 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -606,7 +606,9 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
_LIBCPP_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
|
||||||
|
if (__extbufend_ != __extbufnext_)
|
||||||
|
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||||
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
|
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
|
||||||
|
|||||||
Reference in New Issue
Block a user