minor optimization: don't concatenate strings needlessly
Change-Id: Iddec1a818ff9f3ad8b12491100883e433e4b8246 Reviewed-by: Daniel Teske <daniel.teske@digia.com> (cherry picked from qtcreator/12652c20711fd29dcba62b8d5ba71c077d8bd06c) Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
4b600bd3c1
commit
547b7ed29c
@ -88,6 +88,11 @@ bool IoUtils::isRelativePath(const QString &path)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringRef IoUtils::pathName(const QString &fileName)
|
||||||
|
{
|
||||||
|
return fileName.leftRef(fileName.lastIndexOf(QLatin1Char('/')) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
QStringRef IoUtils::fileName(const QString &fileName)
|
QStringRef IoUtils::fileName(const QString &fileName)
|
||||||
{
|
{
|
||||||
return fileName.midRef(fileName.lastIndexOf(QLatin1Char('/')) + 1);
|
return fileName.midRef(fileName.lastIndexOf(QLatin1Char('/')) + 1);
|
||||||
|
@ -64,6 +64,7 @@ public:
|
|||||||
static bool exists(const QString &fileName) { return fileType(fileName) != FileNotFound; }
|
static bool exists(const QString &fileName) { return fileType(fileName) != FileNotFound; }
|
||||||
static bool isRelativePath(const QString &fileName);
|
static bool isRelativePath(const QString &fileName);
|
||||||
static bool isAbsolutePath(const QString &fileName) { return !isRelativePath(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 QStringRef fileName(const QString &fileName); // Requires normalized path
|
||||||
static QString resolvePath(const QString &baseDir, const QString &fileName);
|
static QString resolvePath(const QString &baseDir, const QString &fileName);
|
||||||
static QString shellQuoteUnix(const QString &arg);
|
static QString shellQuoteUnix(const QString &arg);
|
||||||
|
@ -1866,8 +1866,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile(
|
|||||||
int start_root = 0;
|
int start_root = 0;
|
||||||
QString currFn = currentFileName();
|
QString currFn = currentFileName();
|
||||||
if (IoUtils::fileName(currFn) == IoUtils::fileName(fn)) {
|
if (IoUtils::fileName(currFn) == IoUtils::fileName(fn)) {
|
||||||
|
QStringRef currPath = IoUtils::pathName(currFn);
|
||||||
for (int root = 0; root < m_featureRoots.size(); ++root)
|
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;
|
start_root = root + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user