diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-01-28 13:41:17 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-02-05 11:57:34 -0800 |
commit | 8058127a9df0b66f28908f42e4f533165468de95 (patch) | |
tree | 255a50de76ee5e9bed342f6875d41f0f0ed1600b /src/corelib/global/qlibraryinfo.cpp | |
parent | 8b87c6f1989754aa37aa2a6794954df68d3374d5 (diff) |
QLibraryInfo: remove load-time variable
Since this is only used by qtpaths and qmake, let's not make every
application pay the price of dynamically initializing a QString whenever
QtCore is loaded (which 100% of Qt applications do). Instead,
initializing a null pointer costs zero and is one third the size of
QString. Even the assignment in qmake and qtpaths is faster this way.
Pick-to: 6.3
Change-Id: I6fcda969a9e9427198bffffd16ce8d1eb8dc19da
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/global/qlibraryinfo.cpp')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 52d967ef37..a4764713c4 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -123,8 +123,8 @@ void QLibrarySettings::load() static QSettings *findConfiguration() { - if (!QLibraryInfoPrivate::qtconfManualPath.isEmpty()) - return new QSettings(QLibraryInfoPrivate::qtconfManualPath, QSettings::IniFormat); + if (QLibraryInfoPrivate::qtconfManualPath) + return new QSettings(*QLibraryInfoPrivate::qtconfManualPath, QSettings::IniFormat); QString qtconfig = QStringLiteral(":/qt/etc/qt.conf"); if (QFile::exists(qtconfig)) @@ -156,7 +156,7 @@ static QSettings *findConfiguration() return nullptr; //no luck } -QString QLibraryInfoPrivate::qtconfManualPath; +const QString *QLibraryInfoPrivate::qtconfManualPath = nullptr; QSettings *QLibraryInfoPrivate::configuration() { |