diff options
author | mae <qt-info@nokia.com> | 2011-04-29 09:44:43 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2011-04-29 09:44:43 (GMT) |
commit | 31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5 (patch) | |
tree | 15e8c0132ac06a9614d69e909c233ef811f17aa2 /src/corelib/plugin | |
parent | c85c1ea36cd9ebe6a9ff970d7ba0ce8d08d5b27b (diff) | |
download | Qt-31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5.zip Qt-31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5.tar.gz Qt-31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5.tar.bz2 |
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
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 80e927b..6f3ee1c 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 |