aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-09-17 08:42:07 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2004-09-17 08:42:07 +0000
commitee19761de757468f820e140b1364a07c304ffc32 (patch)
tree0537a78e73d12f3fa97136c05db17217802c0f61
parent4ec7afd748c72bfdcc0aa684c90d6dda478b7a2b (diff)
downloadgcc-ee19761de757468f820e140b1364a07c304ffc32.zip
gcc-ee19761de757468f820e140b1364a07c304ffc32.tar.gz
gcc-ee19761de757468f820e140b1364a07c304ffc32.tar.bz2
basic_file_stdio.cc (__basic_file<>::close)): Don't call unnecessarily sync, that is fflush...
2004-09-17 Paolo Carlini <pcarlini@suse.de> Andrea Arcangeli <andrea@suse.de> * config/io/basic_file_stdio.cc (__basic_file<>::close)): Don't call unnecessarily sync, that is fflush: the library, since 3.4.0 does not use buffered fread/fwrite. * include/bits/fstream.tcc (basic_filebuf<>::overflow): Likewise. Co-Authored-By: Andrea Arcangeli <andrea@suse.de> From-SVN: r87636
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/config/io/basic_file_stdio.cc26
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc4
3 files changed, 21 insertions, 17 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 4598b25..acc46b7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2004-09-17 Paolo Carlini <pcarlini@suse.de>
+ Andrea Arcangeli <andrea@suse.de>
+
+ * config/io/basic_file_stdio.cc (__basic_file<>::close)): Don't
+ call unnecessarily sync, that is fflush: the library, since 3.4.0
+ does not use buffered fread/fwrite.
+ * include/bits/fstream.tcc (basic_filebuf<>::overflow): Likewise.
+
2004-09-15 Mark Mitchell <mark@codesourcery.com>
* config/cpu/arm/cxxabi_tweaks.h (__cxa_cdtor_return_type):
diff --git a/libstdc++-v3/config/io/basic_file_stdio.cc b/libstdc++-v3/config/io/basic_file_stdio.cc
index 680220b..0a4e154 100644
--- a/libstdc++-v3/config/io/basic_file_stdio.cc
+++ b/libstdc++-v3/config/io/basic_file_stdio.cc
@@ -259,23 +259,21 @@ namespace std
__basic_file* __ret = static_cast<__basic_file*>(NULL);
if (this->is_open())
{
- // In general, no need to zero errno in advance if checking
- // for error first. However, C89/C99 (at variance with IEEE
- // 1003.1, f.i.) do not mandate that fclose/fflush must set
- // errno upon error.
- int __err;
- errno = 0;
+ int __err = 0;
if (_M_cfile_created)
- do
- __err = fclose(_M_cfile);
- while (__err && errno == EINTR);
- else
- do
- __err = this->sync();
- while (__err && errno == EINTR);
+ {
+ // In general, no need to zero errno in advance if checking
+ // for error first. However, C89/C99 (at variance with IEEE
+ // 1003.1, f.i.) do not mandate that fclose must set errno
+ // upon error.
+ errno = 0;
+ do
+ __err = fclose(_M_cfile);
+ while (__err && errno == EINTR);
+ }
+ _M_cfile = 0;
if (!__err)
__ret = this;
- _M_cfile = 0;
}
return __ret;
}
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index c24d4ca..d3ea37f 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -396,8 +396,7 @@ namespace std
// Convert pending sequence to external representation,
// and output.
if (_M_convert_to_external(this->pbase(),
- this->pptr() - this->pbase())
- && (!__testeof || !_M_file.sync()))
+ this->pptr() - this->pbase()))
{
_M_set_buffer(0);
__ret = traits_type::not_eof(__c);
@@ -792,7 +791,6 @@ namespace std
{
// Make sure that the internal buffer resyncs its idea of
// the file position with the external file.
- // NB: _M_file.sync() will be called within.
int __ret = 0;
if (this->pbase() < this->pptr())
{