From 31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5 Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 29 Apr 2011 11:44:43 +0200 Subject: 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 --- src/corelib/plugin/qlibrary.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/corelib/plugin') 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 #include #include +#include #ifdef Q_OS_MAC # include #endif @@ -408,12 +409,6 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB typedef QMap LibraryMap; struct LibraryData { - LibraryData() : settings(0) { } - ~LibraryData() { - delete settings; - } - - QSettings *settings; LibraryMap libraryMap; QSet 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 -- cgit v1.2.3