summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemengine_unix.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-03-31 12:01:59 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-07-02 07:39:06 +0000
commit6662919ecde901771d9641fd732aa0735ebb39e6 (patch)
tree449752f7d9582cd685d81829e0e2245b0f9a0ece /src/corelib/io/qfilesystemengine_unix.cpp
parent2185b2f054ddae0fc67b8799b3561c57729f1cd7 (diff)
CoreLib: use QStringRef to optimize memory allocation
Replace substring functions that return QString with corresponding functions that return QStringRef where it's possible. Create QString from QStringRef only where necessary. Change-Id: Id9ea11b16947220cd27787c0b529de62d10b6c26 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/io/qfilesystemengine_unix.cpp')
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index eebe5f1f94..6aaaa4c05a 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -182,8 +182,9 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
#endif
if (!ret.startsWith(QLatin1Char('/'))) {
- if (link.filePath().startsWith(QLatin1Char('/'))) {
- ret.prepend(link.filePath().left(link.filePath().lastIndexOf(QLatin1Char('/')))
+ const QString linkFilePath = link.filePath();
+ if (linkFilePath.startsWith(QLatin1Char('/'))) {
+ ret.prepend(linkFilePath.leftRef(linkFilePath.lastIndexOf(QLatin1Char('/')))
+ QLatin1Char('/'));
} else {
ret.prepend(QDir::currentPath() + QLatin1Char('/'));