summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2011-04-29 11:44:43 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-10 12:54:52 +0200
commit4b75ceea08815c096ec35a077c5c1e3bfca0e5ed (patch)
tree5d77dd989e1659f5d925b3d8d0dbb6aec7c02775 /src/corelib/plugin
parentd454d694080d2a1e6e54f040c374480dd6a91dbc (diff)
Reduce open and stat system calls for QSettings
The patch moves the global static QSettings object from QLibrary to QCoreApplication and reduces a few stat and open calls. Without the patch, a large Trolltech.conf was pushed out of the unused settings cache during startup, meaning Trolltech.conf was parsed more than once. Reviewed-by: Liang Qi (cherry picked from commit 31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5)
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qlibrary.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 80e927bcc9..6f3ee1c3d3 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -52,6 +52,7 @@
#include <qmap.h>
#include <qsettings.h>
#include <qdatetime.h>
+#include <private/qcoreapplication_p.h>
#ifdef Q_OS_MAC
# include <private/qcore_mac_p.h>
#endif
@@ -408,12 +409,6 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB
typedef QMap<QString, QLibraryPrivate*> LibraryMap;
struct LibraryData {
- LibraryData() : settings(0) { }
- ~LibraryData() {
- delete settings;
- }
-
- QSettings *settings;
LibraryMap libraryMap;
QSet<QLibraryPrivate*> loadedLibs;
};
@@ -711,11 +706,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
QStringList reg;
#ifndef QT_NO_SETTINGS
if (!settings) {
- settings = libraryData()->settings;
- if (!settings) {
- settings = new QSettings(QSettings::UserScope, QLatin1String("Trolltech"));
- libraryData()->settings = settings;
- }
+ settings = QCoreApplicationPrivate::trolltechConf;
}
reg = settings->value(regkey).toStringList();
#endif