mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-23 06:58:54 +08:00
sstream.tcc (pbackfail): Remove redundant NULL pointer check from test involving _M_in_*.
2003-04-20 Paolo Carlini <pcarlini@unitus.it> * include/bits/sstream.tcc (pbackfail): Remove redundant NULL pointer check from test involving _M_in_*. (overflow, seekoff, seekpos): Const qualify bool variables. * include/std/std_sstream.h (underflow): Remove redundant NULL pointer check from test involving _M_in_*. (_M_really_sync): Const qualify bool variables. * src/fstream.cc (_M_underflow_common): Remove redundant NULL pointer check from test involving _M_in_*, const qualify bool variables. * include/std/std_streambuf.h (sgetc): Remove redundant variable. From-SVN: r65853
This commit is contained in:
parent
1052bb09b8
commit
5e77a35767
@ -1,3 +1,18 @@
|
|||||||
|
2003-04-20 Paolo Carlini <pcarlini@unitus.it>
|
||||||
|
|
||||||
|
* include/bits/sstream.tcc (pbackfail): Remove redundant
|
||||||
|
NULL pointer check from test involving _M_in_*.
|
||||||
|
(overflow, seekoff, seekpos): Const qualify bool variables.
|
||||||
|
* include/std/std_sstream.h (underflow): Remove redundant
|
||||||
|
NULL pointer check from test involving _M_in_*.
|
||||||
|
(_M_really_sync): Const qualify bool variables.
|
||||||
|
* src/fstream.cc (_M_underflow_common): Remove redundant
|
||||||
|
NULL pointer check from test involving _M_in_*, const qualify
|
||||||
|
bool variables.
|
||||||
|
|
||||||
|
* include/std/std_streambuf.h (sgetc): Remove redundant
|
||||||
|
variable.
|
||||||
|
|
||||||
2003-04-18 Paolo Carlini <pcarlini@unitus.it>
|
2003-04-18 Paolo Carlini <pcarlini@unitus.it>
|
||||||
|
|
||||||
According to 5.9 para 2 (second bullet) for pointers p, q
|
According to 5.9 para 2 (second bullet) for pointers p, q
|
||||||
|
@ -47,8 +47,9 @@ namespace std
|
|||||||
pbackfail(int_type __c)
|
pbackfail(int_type __c)
|
||||||
{
|
{
|
||||||
int_type __ret = traits_type::eof();
|
int_type __ret = traits_type::eof();
|
||||||
bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
|
const bool __testeof =
|
||||||
bool __testpos = this->_M_in_cur && this->_M_in_beg < this->_M_in_cur;
|
traits_type::eq_int_type(__c, traits_type::eof());
|
||||||
|
const bool __testpos = this->_M_in_beg < this->_M_in_cur;
|
||||||
|
|
||||||
// Try to put back __c into input sequence in one of three ways.
|
// Try to put back __c into input sequence in one of three ways.
|
||||||
// Order these tests done in is unspecified by the standard.
|
// Order these tests done in is unspecified by the standard.
|
||||||
@ -80,11 +81,12 @@ namespace std
|
|||||||
basic_stringbuf<_CharT, _Traits, _Alloc>::
|
basic_stringbuf<_CharT, _Traits, _Alloc>::
|
||||||
overflow(int_type __c)
|
overflow(int_type __c)
|
||||||
{
|
{
|
||||||
bool __testout = this->_M_mode & ios_base::out;
|
const bool __testout = this->_M_mode & ios_base::out;
|
||||||
if (__builtin_expect(!__testout, false))
|
if (__builtin_expect(!__testout, false))
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
|
|
||||||
bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
|
const bool __testeof =
|
||||||
|
traits_type::eq_int_type(__c, traits_type::eof());
|
||||||
if (__builtin_expect(__testeof, false))
|
if (__builtin_expect(__testeof, false))
|
||||||
return traits_type::not_eof(__c);
|
return traits_type::not_eof(__c);
|
||||||
|
|
||||||
@ -94,7 +96,7 @@ namespace std
|
|||||||
// suit particular needs.
|
// suit particular needs.
|
||||||
__size_type __len = std::max(__size_type(_M_string.capacity() + 1),
|
__size_type __len = std::max(__size_type(_M_string.capacity() + 1),
|
||||||
__size_type(512));
|
__size_type(512));
|
||||||
bool __testput = this->_M_out_cur < this->_M_out_end;
|
const bool __testput = this->_M_out_cur < this->_M_out_end;
|
||||||
if (__builtin_expect(!__testput && __len > _M_string.max_size(), false))
|
if (__builtin_expect(!__testput && __len > _M_string.max_size(), false))
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
|
|
||||||
@ -123,7 +125,7 @@ namespace std
|
|||||||
pos_type __ret = pos_type(off_type(-1));
|
pos_type __ret = pos_type(off_type(-1));
|
||||||
bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
|
bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
|
||||||
bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
|
bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
|
||||||
bool __testboth = __testin && __testout && __way != ios_base::cur;
|
const bool __testboth = __testin && __testout && __way != ios_base::cur;
|
||||||
__testin &= !(__mode & ios_base::out);
|
__testin &= !(__mode & ios_base::out);
|
||||||
__testout &= !(__mode & ios_base::in);
|
__testout &= !(__mode & ios_base::in);
|
||||||
|
|
||||||
@ -189,8 +191,8 @@ namespace std
|
|||||||
off_type __pos = __sp; // Use streamoff operator to do conversion.
|
off_type __pos = __sp; // Use streamoff operator to do conversion.
|
||||||
char_type* __beg = NULL;
|
char_type* __beg = NULL;
|
||||||
char_type* __end = NULL;
|
char_type* __end = NULL;
|
||||||
bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
|
const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
|
||||||
bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
|
const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
|
||||||
|
|
||||||
// NB: Ordered.
|
// NB: Ordered.
|
||||||
bool __testposi = false;
|
bool __testposi = false;
|
||||||
|
@ -190,7 +190,7 @@ namespace std
|
|||||||
virtual int_type
|
virtual int_type
|
||||||
underflow()
|
underflow()
|
||||||
{
|
{
|
||||||
if (this->_M_in_cur && this->_M_in_cur < this->_M_in_end)
|
if (this->_M_in_cur < this->_M_in_end)
|
||||||
return traits_type::to_int_type(*gptr());
|
return traits_type::to_int_type(*gptr());
|
||||||
else
|
else
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
@ -260,8 +260,8 @@ namespace std
|
|||||||
virtual void
|
virtual void
|
||||||
_M_really_sync(char_type* __base, __size_type __i, __size_type __o)
|
_M_really_sync(char_type* __base, __size_type __i, __size_type __o)
|
||||||
{
|
{
|
||||||
bool __testin = this->_M_mode & ios_base::in;
|
const bool __testin = this->_M_mode & ios_base::in;
|
||||||
bool __testout = this->_M_mode & ios_base::out;
|
const bool __testout = this->_M_mode & ios_base::out;
|
||||||
__size_type __len = _M_string.size();
|
__size_type __len = _M_string.size();
|
||||||
|
|
||||||
this->_M_buf = __base;
|
this->_M_buf = __base;
|
||||||
|
@ -452,12 +452,10 @@ namespace std
|
|||||||
int_type
|
int_type
|
||||||
sgetc()
|
sgetc()
|
||||||
{
|
{
|
||||||
int_type __ret;
|
|
||||||
if (_M_in_cur < _M_in_end)
|
if (_M_in_cur < _M_in_end)
|
||||||
__ret = traits_type::to_int_type(*(this->gptr()));
|
return traits_type::to_int_type(*(this->gptr()));
|
||||||
else
|
else
|
||||||
__ret = this->underflow();
|
return this->underflow();
|
||||||
return __ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,10 +41,10 @@ namespace std
|
|||||||
basic_filebuf<char>::_M_underflow_common(bool __bump)
|
basic_filebuf<char>::_M_underflow_common(bool __bump)
|
||||||
{
|
{
|
||||||
int_type __ret = traits_type::eof();
|
int_type __ret = traits_type::eof();
|
||||||
bool __testin = _M_mode & ios_base::in;
|
const bool __testin = _M_mode & ios_base::in;
|
||||||
bool __testout = _M_mode & ios_base::out;
|
const bool __testout = _M_mode & ios_base::out;
|
||||||
// Sync with stdio.
|
// Sync with stdio.
|
||||||
bool __sync = _M_buf_size <= 1;
|
const bool __sync = _M_buf_size <= 1;
|
||||||
|
|
||||||
if (__testin)
|
if (__testin)
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ namespace std
|
|||||||
if (_M_pback_init)
|
if (_M_pback_init)
|
||||||
_M_pback_destroy();
|
_M_pback_destroy();
|
||||||
|
|
||||||
if (_M_in_cur && _M_in_cur < _M_in_end)
|
if (_M_in_cur < _M_in_end)
|
||||||
{
|
{
|
||||||
__ret = traits_type::to_int_type(*_M_in_cur);
|
__ret = traits_type::to_int_type(*_M_in_cur);
|
||||||
if (__bump)
|
if (__bump)
|
||||||
@ -64,8 +64,8 @@ namespace std
|
|||||||
|
|
||||||
// Sync internal and external buffers.
|
// Sync internal and external buffers.
|
||||||
// NB: __testget -> __testput as _M_buf_unified here.
|
// NB: __testget -> __testput as _M_buf_unified here.
|
||||||
bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
|
const bool __testget = _M_in_beg < _M_in_cur;
|
||||||
bool __testinit = _M_is_indeterminate();
|
const bool __testinit = _M_is_indeterminate();
|
||||||
if (__testget)
|
if (__testget)
|
||||||
{
|
{
|
||||||
if (__testout)
|
if (__testout)
|
||||||
@ -123,10 +123,10 @@ namespace std
|
|||||||
basic_filebuf<wchar_t>::_M_underflow_common(bool __bump)
|
basic_filebuf<wchar_t>::_M_underflow_common(bool __bump)
|
||||||
{
|
{
|
||||||
int_type __ret = traits_type::eof();
|
int_type __ret = traits_type::eof();
|
||||||
bool __testin = _M_mode & ios_base::in;
|
const bool __testin = _M_mode & ios_base::in;
|
||||||
bool __testout = _M_mode & ios_base::out;
|
const bool __testout = _M_mode & ios_base::out;
|
||||||
// Sync with stdio.
|
// Sync with stdio.
|
||||||
bool __sync = _M_buf_size <= 1;
|
const bool __sync = _M_buf_size <= 1;
|
||||||
|
|
||||||
if (__testin)
|
if (__testin)
|
||||||
{
|
{
|
||||||
@ -136,7 +136,7 @@ namespace std
|
|||||||
if (_M_pback_init)
|
if (_M_pback_init)
|
||||||
_M_pback_destroy();
|
_M_pback_destroy();
|
||||||
|
|
||||||
if (_M_in_cur && _M_in_cur < _M_in_end)
|
if (_M_in_cur < _M_in_end)
|
||||||
{
|
{
|
||||||
__ret = traits_type::to_int_type(*_M_in_cur);
|
__ret = traits_type::to_int_type(*_M_in_cur);
|
||||||
if (__bump)
|
if (__bump)
|
||||||
@ -146,8 +146,8 @@ namespace std
|
|||||||
|
|
||||||
// Sync internal and external buffers.
|
// Sync internal and external buffers.
|
||||||
// NB: __testget -> __testput as _M_buf_unified here.
|
// NB: __testget -> __testput as _M_buf_unified here.
|
||||||
bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
|
const bool __testget = _M_in_beg < _M_in_cur;
|
||||||
bool __testinit = _M_is_indeterminate();
|
const bool __testinit = _M_is_indeterminate();
|
||||||
if (__testget)
|
if (__testget)
|
||||||
{
|
{
|
||||||
if (__testout)
|
if (__testout)
|
||||||
|
Loading…
Reference in New Issue
Block a user