[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kservice] src/sycoca: Optimization: openDatabase already calls checkVersion, remove redundant call
From:       David Faure <null () kde ! org>
Date:       2016-12-31 12:59:19
Message-ID: E1cNJFn-0004F7-O3 () code ! kde ! org
[Download RAW message or body]

Git commit e7596c91f9bd11d2c217d659b8ea5bb9041236ab by David Faure.
Committed on 31/12/2016 at 12:54.
Pushed by dfaure into branch 'master'.

Optimization: openDatabase already calls checkVersion, remove redundant call

M  +9    -11   src/sycoca/ksycoca.cpp
M  +1    -1    src/sycoca/ksycocautils_p.h

https://commits.kde.org/kservice/e7596c91f9bd11d2c217d659b8ea5bb9041236ab

diff --git a/src/sycoca/ksycoca.cpp b/src/sycoca/ksycoca.cpp
index 9c9cddc..4c8bc75 100644
--- a/src/sycoca/ksycoca.cpp
+++ b/src/sycoca/ksycoca.cpp
@@ -332,7 +332,7 @@ void KSycocaPrivate::slotDatabaseChanged()
     changeList = QStringList() << QStringLiteral("services") << \
QStringLiteral("servicetypes") << QStringLiteral("xdgdata-mime") << \
QStringLiteral("apps");  
     qCDebug(SYCOCA) << QThread::currentThread() << "got a notifyDatabaseChanged \
                signal";
-    // kbuildsycoca tells us the database file changed
+    // KDirWatch tells us the database file changed
     // We would have found out in the next call to ensureCacheValid(), but for
     // now keep the call to closeDatabase, to help refcounting to 0 the old mmaped \
file earlier.  closeDatabase();
@@ -508,20 +508,18 @@ bool KSycocaPrivate::checkDatabase(BehaviorsIfNotFound \
ifNotFound)  
     // Check if new database already available
     if (openDatabase(ifNotFound & IfNotFoundOpenDummy)) {
-        if (checkVersion()) {
-            // Database exists, and version is ok, we can read it.
+        // Database exists, and version is ok, we can read it.
 
-            if (qAppName() != KBUILDSYCOCA_EXENAME && ifNotFound != \
IfNotFoundDoNothing) { +        if (qAppName() != KBUILDSYCOCA_EXENAME && ifNotFound \
!= IfNotFoundDoNothing) {  
-                // Ensure it's uptodate, rebuild if needed
-                checkDirectories();
+            // Ensure it's uptodate, rebuild if needed
+            checkDirectories();
 
-                // Don't check again for some time
-                m_lastCheck.start();
-            }
-
-            return true;
+            // Don't check again for some time
+            m_lastCheck.start();
         }
+
+        return true;
     }
 
     if (ifNotFound & IfNotFoundRecreate) {
diff --git a/src/sycoca/ksycocautils_p.h b/src/sycoca/ksycocautils_p.h
index 9164c15..f144a80 100644
--- a/src/sycoca/ksycocautils_p.h
+++ b/src/sycoca/ksycocautils_p.h
@@ -53,7 +53,7 @@ bool visitResourceDirectoryHelper(const QString &dirname, Visitor \
visitor)  
 // visitor is a function/functor accepts QFileInfo as argument and returns bool
 // visitResourceDirectory will visit the resource directory in a depth-first way.
-// visitor can terimnate the visit by returning false, and visitResourceDirectory
+// visitor can terminate the visit by returning false, and visitResourceDirectory
 // will also return false in this case, otherwise it will return true.
 template<typename Visitor>
 bool visitResourceDirectory(const QString &dirname, Visitor visitor)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic