[PATCH] Cleanup in istream.tcc

Pétur Runólfsson peturr02@ru.is
Mon Sep 22 09:36:00 GMT 2003


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. 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: istream-cleanup.diff
Type: application/octet-stream
Size: 1336 bytes
Desc: istream-cleanup.diff
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030922/75ff2cde/attachment.obj>


More information about the Libstdc++ mailing list