Small optimization of wxFFile::ReadAll(): avoid extra string copy.
Use swap() to move the newly created string into its destination instead of copying it there. This can be relatively important as the string represents an entire file contents here and so could be quite long. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -117,7 +117,9 @@ bool wxFFile::ReadAll(wxString *str, const wxMBConv& conv)
|
||||
}
|
||||
|
||||
buf.data()[length] = 0;
|
||||
*str = wxString(buf, conv);
|
||||
|
||||
wxString strTmp(buf, conv);
|
||||
str->swap(strTmp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user