Micro optimize string concatenation in wxFileSystem::OpenFile()

Concatenate the string only once instead of doing it several times.
Compiler might be optimizing this anyhow in release builds, but it
definitely helps in at least the debug ones and doesn't cost anything.
This commit is contained in:
Vadim Zeitlin 2021-04-15 18:22:16 +01:00
parent 97750eb282
commit b9bd932077

View File

@ -480,14 +480,15 @@ wxFSFile* wxFileSystem::OpenFile(const wxString& location, int flags)
// try relative paths first :
if (meta != wxT(':') && !m_Path.empty())
{
const wxString fullloc = m_Path + loc;
node = m_Handlers.GetFirst();
while (node)
{
wxFileSystemHandler *h = (wxFileSystemHandler*) node -> GetData();
if (h->CanOpen(m_Path + loc))
if (h->CanOpen(fullloc))
{
s = MakeLocal(h)->OpenFile(*this, m_Path + loc);
if (s) { m_LastName = m_Path + loc; break; }
s = MakeLocal(h)->OpenFile(*this, fullloc);
if (s) { m_LastName = fullloc; break; }
}
node = node->GetNext();
}