From 2b31356ac9faaa3ad9522d3e8b0dd00d90877476 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 13 Nov 2014 18:02:02 +0100 Subject: [PATCH] optimize filePrefixRoot() more efficient use of string functions. Change-Id: I3d95d6379eaab025b18449b706f93631a2132aad Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index d2b11aaa017..5d9ce7af084 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1190,11 +1190,13 @@ MakefileGenerator::writeObj(QTextStream &t, const char *src) QString MakefileGenerator::filePrefixRoot(const QString &root, const QString &path) { - QString ret(root + path); + QString ret(path); if(path.length() > 2 && path[1] == ':') //c:\foo - ret = QString(path.mid(0, 2) + root + path.mid(2)); - while(ret.endsWith("\\")) - ret = ret.left(ret.length()-1); + ret.insert(2, root); + else + ret.prepend(root); + while (ret.endsWith('\\')) + ret.chop(1); return ret; }