aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@unitus.it>2003-04-26 10:31:57 +0200
committerPaolo Carlini <paolo@gcc.gnu.org>2003-04-26 08:31:57 +0000
commitc7f79b4cb298e12acd56406db24107614ac9a76b (patch)
treefea10255902f1e4fca59dad646f2046503de84fe
parentac5b7972ab74cf9c49c95ae311321e4b407313cd (diff)
downloadgcc-c7f79b4cb298e12acd56406db24107614ac9a76b.zip
gcc-c7f79b4cb298e12acd56406db24107614ac9a76b.tar.gz
gcc-c7f79b4cb298e12acd56406db24107614ac9a76b.tar.bz2
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/fstream.tcc (pbackfail): Shorten a bit (10 lines) the innermost 'if' by factoring out some code. From-SVN: r66102
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc22
2 files changed, 11 insertions, 16 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b788831..926973d 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,10 @@
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
use in_avail(), simplify.
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index 7a8ae3b..454660d 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -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;