Commit 12652c20 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

minor optimization: don't concatenate strings needlessly



Change-Id: Iddec1a818ff9f3ad8b12491100883e433e4b8246
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent ff464d7b
......@@ -76,6 +76,11 @@ bool IoUtils::isRelativePath(const QString &path)
return true;
}
QStringRef IoUtils::pathName(const QString &fileName)
{
return fileName.leftRef(fileName.lastIndexOf(QLatin1Char('/')) + 1);
}
QStringRef IoUtils::fileName(const QString &fileName)
{
return fileName.midRef(fileName.lastIndexOf(QLatin1Char('/')) + 1);
......
......@@ -52,6 +52,7 @@ public:
static bool exists(const QString &fileName) { return fileType(fileName) != FileNotFound; }
static bool isRelativePath(const QString &fileName);
static bool isAbsolutePath(const QString &fileName) { return !isRelativePath(fileName); }
static QStringRef pathName(const QString &fileName); // Requires normalized path
static QStringRef fileName(const QString &fileName); // Requires normalized path
static QString resolvePath(const QString &baseDir, const QString &fileName);
static QString shellQuoteUnix(const QString &arg);
......
......@@ -1845,8 +1845,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile(
int start_root = 0;
QString currFn = currentFileName();
if (IoUtils::fileName(currFn) == IoUtils::fileName(fn)) {
QStringRef currPath = IoUtils::pathName(currFn);
for (int root = 0; root < m_featureRoots.size(); ++root)
if (currFn == m_featureRoots.at(root) + fn) {
if (currPath == m_featureRoots.at(root)) {
start_root = root + 1;
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment