sstream.tcc (pbackfail): Shorten a bit (6 lines) the innermost 'if' by factoring...
authorPaolo Carlini <pcarlini@unitus.it>
Mon, 28 Apr 2003 21:28:25 +0000 (23:28 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 28 Apr 2003 21:28:25 +0000 (21:28 +0000)
2003-04-28  Paolo Carlini  <pcarlini@unitus.it>

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

From-SVN: r66187

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

index 75c88010ff0168c4963bd0c253b44ce3b4eb9cc6..cc8ed88c95cdf925c8747c31de82bd2a34470155 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-28  Paolo Carlini  <pcarlini@unitus.it>
+
+       * include/bits/sstream.tcc (pbackfail): Shorten a bit (6 lines)
+       the innermost 'if' by factoring out some code.
+
 2003-04-28  Phil Edwards  <pme@gcc.gnu.org>
 
        * configure.in:  Test for libintl.h.
index 801a34a4dba50d992545f8d2d8b1b7242c1cdbcd..1d8cc005d98332085835c562f98c727aededeaa0 100644 (file)
@@ -55,24 +55,19 @@ namespace std
       // Order these tests done in is unspecified by the standard.
       if (__testpos)
        {
-         if (traits_type::eq(traits_type::to_char_type(__c),
-                             this->_M_in_cur[-1])
-             && !__testeof)
-           {
-             --this->_M_in_cur;
-             __ret = __c;
-           }
-         else if (!__testeof)
+         const bool __testeq = traits_type::eq(traits_type::to_char_type(__c),
+                                               this->_M_in_cur[-1]);
+         
+         --this->_M_in_cur;
+         if (!__testeof && __testeq)
+           __ret = __c;
+         else if (__testeof)
+           __ret = traits_type::not_eof(__c);
+         else
            {
-             --this->_M_in_cur;
              *this->_M_in_cur = traits_type::to_char_type(__c);
              __ret = __c;
            }
-         else if (__testeof)
-           {
-             --this->_M_in_cur;
-             __ret = traits_type::not_eof(__c);
-           }
        }
       return __ret;
     }