fstream.tcc (pbackfail): Shorten a bit (10 lines) the innermost 'if' by factoring...
authorPaolo Carlini <pcarlini@unitus.it>
Sat, 26 Apr 2003 08:31:57 +0000 (10:31 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 26 Apr 2003 08:31:57 +0000 (08:31 +0000)
2003-04-26  Paolo Carlini  <pcarlini@unitus.it>

* include/bits/fstream.tcc (pbackfail): Shorten a bit (10 lines)
the innermost 'if' by factoring out some code.

From-SVN: r66102

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fstream.tcc

index b78883113012a7585dc6a2b6f571295f8d38b475..926973d2ea816389ffa42a823e04cf191189774c 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-26  Paolo Carlini  <pcarlini@unitus.it>
+
+       * include/bits/fstream.tcc (pbackfail): Shorten a bit (10 lines)
+       the innermost 'if' by factoring out some code.
+
 2003-04-26  Paolo Carlini  <pcarlini@unitus.it>
 
        * include/bits/streambuf.tcc (__copy_streambufs): Don't
index 7a8ae3b2d5a4c38a87342e1d5f724bd3c7b46755..454660d5768965a5f298f627b9a8a64639c3da59 100644 (file)
@@ -203,27 +203,17 @@ namespace std
              const bool __testout = this->_M_mode & ios_base::out;
              const bool __testeq = traits_type::eq(__c, this->_M_in_cur[-1]);
 
+             --this->_M_in_cur;
+             if (__testout)
+               --this->_M_out_cur;
              // Try to put back __c into input sequence in one of three ways.
              // Order these tests done in is unspecified by the standard.
              if (!__testeof && __testeq)
-               {
-                 --this->_M_in_cur;
-                 if (__testout)
-                   --this->_M_out_cur;
-                 __ret = __i;
-               }
+               __ret = __i;
              else if (__testeof)
+               __ret = traits_type::not_eof(__i);
+             else
                {
-                 --this->_M_in_cur;
-                 if (__testout)
-                   --this->_M_out_cur;
-                 __ret = traits_type::not_eof(__i);
-               }
-             else if (!__testeof)
-               {
-                 --this->_M_in_cur;
-                 if (__testout)
-                   --this->_M_out_cur;
                  _M_pback_create();
                  *this->_M_in_cur = __c; 
                  __ret = __i;