From 20160a32ea4bf31e4069618e6584a9e7067892b5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 11 Feb 2007 02:09:39 +0000 Subject: [PATCH] write the entire file at once in Flush() instead of doing it line by line (patch 1656509) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/fileconf.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 06c4a1e2d0..6352e8cdfb 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -1047,15 +1047,17 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) } // write all strings to file + wxString filetext; + filetext.reserve(4096); for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() ) { - wxString line = p->Text(); - line += wxTextFile::GetEOL(); - if ( !file.Write(line, *m_conv) ) - { - wxLogError(_("can't write user configuration file.")); - return false; - } + filetext << p->Text() << wxTextFile::GetEOL(); + } + + if ( !file.Write(filetext, *m_conv) ) + { + wxLogError(_("can't write user configuration file.")); + return false; } if ( !file.Commit() ) -- 2.45.2