]> git.saurik.com Git - wxWidgets.git/commitdiff
write the entire file at once in Flush() instead of doing it line by line (patch...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 11 Feb 2007 02:09:39 +0000 (02:09 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 11 Feb 2007 02:09:39 +0000 (02:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/fileconf.cpp

index 06c4a1e2d0877edd82d69074e5e0cc3f62d5ec7c..6352e8cdfbcefa5bb512c93780a51310783b23ff 100644 (file)
@@ -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() )