This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Cleanup in istream.tcc


Several functions in istream.tcc use the construct

sentry __cerb(*this, true);
if (__cerb) 
  {
    // ...
  }
else
  this->setstate(ios_base::failbit);

The call to setstate is redundant since sentry::operator bool() only
returns false if sentry::sentry() has already set failbit.

Tested on i686-pc-linux-gnu.

Petur

2003-09-22  Petur Runolfsson  <peturr02@ru.is>

	* include/bits/istream.tcc (basic_istream::read,
	basic_istream::readsome, basic_istream::putback,
	basic_istream::unget, operator>>(basic_istream, CharT)):
	Avoid redundant setstate(failbit) calls when sentry::operator bool()
	returns false. 

Attachment: istream-cleanup.diff
Description: istream-cleanup.diff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]