From ca55ddafc882115e4dedab279ffa72fff174407a Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Mon, 20 Jul 2009 16:58:29 +0200
Subject: [PATCH] make the feature file search do fewer useless stat()s

qmake ensures that the file name ends with .prf, so there is no point if
we try it without first.
---
 src/shared/proparser/profileevaluator.cpp | 26 +++++++++--------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp
index 32a2b6f1caa..05d5c94f619 100644
--- a/src/shared/proparser/profileevaluator.cpp
+++ b/src/shared/proparser/profileevaluator.cpp
@@ -2389,26 +2389,20 @@ bool ProFileEvaluator::Private::evaluateFile(const QString &fileName)
 
 bool ProFileEvaluator::Private::evaluateFeatureFile(const QString &fileName)
 {
-    QString fn;
+    QString fn = QLatin1Char('/') + fileName;
+    if (!fn.endsWith(QLatin1String(".prf")))
+        fn += QLatin1String(".prf");
     foreach (const QString &path, qmakeFeaturePaths()) {
-        QString fname = path + QLatin1Char('/') + fileName;
+        QString fname = path + fn;
         if (QFileInfo(fname).exists()) {
-            fn = fname;
-            break;
-        }
-        fname += QLatin1String(".prf");
-        if (QFileInfo(fname).exists()) {
-            fn = fname;
-            break;
+            bool cumulative = m_cumulative;
+            m_cumulative = false;
+            bool ok = evaluateFile(fname);
+            m_cumulative = cumulative;
+            return ok;
         }
     }
-    if (fn.isEmpty())
-        return false;
-    bool cumulative = m_cumulative;
-    m_cumulative = false;
-    bool ok = evaluateFile(fn);
-    m_cumulative = cumulative;
-    return ok;
+    return false;
 }
 
 QString ProFileEvaluator::Private::format(const char *fmt) const
-- 
GitLab