Commit ee19761d by Paolo Carlini Committed by Paolo Carlini

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
parent 4ec7afd7
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> 2004-09-15 Mark Mitchell <mark@codesourcery.com>
* config/cpu/arm/cxxabi_tweaks.h (__cxa_cdtor_return_type): * config/cpu/arm/cxxabi_tweaks.h (__cxa_cdtor_return_type):
......
...@@ -259,23 +259,21 @@ namespace std ...@@ -259,23 +259,21 @@ namespace std
__basic_file* __ret = static_cast<__basic_file*>(NULL); __basic_file* __ret = static_cast<__basic_file*>(NULL);
if (this->is_open()) if (this->is_open())
{ {
int __err = 0;
if (_M_cfile_created)
{
// In general, no need to zero errno in advance if checking // In general, no need to zero errno in advance if checking
// for error first. However, C89/C99 (at variance with IEEE // for error first. However, C89/C99 (at variance with IEEE
// 1003.1, f.i.) do not mandate that fclose/fflush must set // 1003.1, f.i.) do not mandate that fclose must set errno
// errno upon error. // upon error.
int __err;
errno = 0; errno = 0;
if (_M_cfile_created)
do do
__err = fclose(_M_cfile); __err = fclose(_M_cfile);
while (__err && errno == EINTR); while (__err && errno == EINTR);
else }
do _M_cfile = 0;
__err = this->sync();
while (__err && errno == EINTR);
if (!__err) if (!__err)
__ret = this; __ret = this;
_M_cfile = 0;
} }
return __ret; return __ret;
} }
......
...@@ -396,8 +396,7 @@ namespace std ...@@ -396,8 +396,7 @@ namespace std
// Convert pending sequence to external representation, // Convert pending sequence to external representation,
// and output. // and output.
if (_M_convert_to_external(this->pbase(), if (_M_convert_to_external(this->pbase(),
this->pptr() - this->pbase()) this->pptr() - this->pbase()))
&& (!__testeof || !_M_file.sync()))
{ {
_M_set_buffer(0); _M_set_buffer(0);
__ret = traits_type::not_eof(__c); __ret = traits_type::not_eof(__c);
...@@ -792,7 +791,6 @@ namespace std ...@@ -792,7 +791,6 @@ namespace std
{ {
// Make sure that the internal buffer resyncs its idea of // Make sure that the internal buffer resyncs its idea of
// the file position with the external file. // the file position with the external file.
// NB: _M_file.sync() will be called within.
int __ret = 0; int __ret = 0;
if (this->pbase() < this->pptr()) if (this->pbase() < this->pptr())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment