aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/proparser
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-10-24 14:58:11 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-01 17:35:14 +0000
commitcf82f210804151452fce3cddb3cb2793dab976eb (patch)
treef0fbfa9ef46eb957aebb68ee2c1444c9c03cfb0d /src/shared/proparser
parent5ba32e3484ead2e35cc7732dcd59a97e7459dbfd (diff)
shave off duplicate stat()ing of source files
ProFileEvaluator::absoluteFileValues() now returns only files, which allows us to skip the subsequent QFileInfo::isFile() calls at some call sites. as a side effect, IoUtils::fileType() does not see anything except regular files and directories any more. that's not expected to be a problem, given the function's scope. Change-Id: I53063ad8cacb3afe5cc1baf6d6d5feba3465e74f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/shared/proparser')
-rw-r--r--src/shared/proparser/ioutils.cpp2
-rw-r--r--src/shared/proparser/profileevaluator.cpp1
-rw-r--r--src/shared/proparser/qmakevfs.cpp2
3 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp
index 57b2812c8f..4239d6ba5c 100644
--- a/src/shared/proparser/ioutils.cpp
+++ b/src/shared/proparser/ioutils.cpp
@@ -52,7 +52,7 @@ IoUtils::FileType IoUtils::fileType(const QString &fileName)
struct ::stat st;
if (::stat(fileName.toLocal8Bit().constData(), &st))
return FileNotFound;
- return S_ISDIR(st.st_mode) ? FileIsDir : FileIsRegular;
+ return S_ISDIR(st.st_mode) ? FileIsDir : S_ISREG(st.st_mode) ? FileIsRegular : FileNotFound;
#endif
}
diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp
index 5b937d3f09..1df3dc4b51 100644
--- a/src/shared/proparser/profileevaluator.cpp
+++ b/src/shared/proparser/profileevaluator.cpp
@@ -153,6 +153,7 @@ QStringList ProFileEvaluator::absoluteFileValues(
if (wildcard.contains(QLatin1Char('*')) || wildcard.contains(QLatin1Char('?'))) {
wildcard.detach(); // Keep m_tmp out of QRegExp's cache
QDir theDir(absDir);
+ theDir.setFilter(theDir.filter() & ~QDir::AllDirs);
foreach (const QString &fn, theDir.entryList(QStringList(wildcard)))
if (fn != QLatin1String(".") && fn != QLatin1String(".."))
result << absDir + QLatin1Char('/') + fn;
diff --git a/src/shared/proparser/qmakevfs.cpp b/src/shared/proparser/qmakevfs.cpp
index 81759fa816..a46b211aef 100644
--- a/src/shared/proparser/qmakevfs.cpp
+++ b/src/shared/proparser/qmakevfs.cpp
@@ -169,7 +169,7 @@ bool QMakeVfs::exists(const QString &fn)
if (it != m_files.constEnd())
return it->constData() != m_magicMissing.constData();
#endif
- bool ex = IoUtils::exists(fn);
+ bool ex = IoUtils::fileType(fn) == IoUtils::FileIsRegular;
#ifndef PROEVALUATOR_FULL
m_files[fn] = ex ? m_magicExisting : m_magicMissing;
#endif