qmake: Don't call QDir::count() over and over

This can be expensive. We don't expect files to be added to the
directory while qmake is running, and if that happened, the result would
be unpredictable anyway.

Change-Id: I5db93132046c1284130bbe51ce1ecd2a14665206
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ulf Hermann 2019-10-28 11:14:11 +01:00
parent a317bff298
commit fc3c6cde83

View File

@ -1043,7 +1043,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
for (int d = 0; d < dirs.count(); d++) {
QString dir = dirs[d];
QDir qdir(pfx + dir);
for (int i = 0; i < (int)qdir.count(); ++i) {
for (int i = 0, count = int(qdir.count()); i < count; ++i) {
if (qdir[i] == statics.strDot || qdir[i] == statics.strDotDot)
continue;
QString fname = dir + qdir[i];