summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qpluginloader.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-06-17 14:08:48 -0700
committerThiago Macieira <thiago.macieira@intel.com>2024-07-08 18:13:05 -0700
commit9daf344c8d403c96789f7f041865cd6d181c2065 (patch)
tree3bf1f57367eb4936411a87ce5bc9142ff6be2f1a /src/corelib/plugin/qpluginloader.cpp
parent2be44b57da951007ecab4d6c9e4bc2f3b5cd067a (diff)
QLibrary: move prefixes_sys() to the header and make it prefix_sys()
There's only one prefix for Unix ("lib") and none for Windows, so there's no need to allocate a QList for it in this function. For one of the two callers, it was also possible to avoid the QList and QString allocations, at the expense of testing the same file twice on Windows. We can't do the same for Unix systems because we may add more elements to the QList. Change-Id: Ic0adfa808d28487a8303fffd17d9e6d35aaa79f4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/plugin/qpluginloader.cpp')
-rw-r--r--src/corelib/plugin/qpluginloader.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 03b8cfbb848..df154f7e8dd 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -229,8 +229,7 @@ static QString locatePlugin(const QString& fileName)
return fi.canonicalFilePath();
}
}
- QStringList prefixes = QLibraryPrivate::prefixes_sys();
- prefixes.prepend(QString());
+ std::array<QStringView, 2> prefixes = { QStringView(), QLibraryPrivate::prefix_sys() };
QStringList suffixes = QLibraryPrivate::suffixes_sys(QString());
suffixes.prepend(QString());
@@ -247,7 +246,7 @@ static QString locatePlugin(const QString& fileName)
}
for (const QString &path : std::as_const(paths)) {
- for (const QString &prefix : std::as_const(prefixes)) {
+ for (QStringView prefix : prefixes) {
for (const QString &suffix : std::as_const(suffixes)) {
#ifdef Q_OS_ANDROID
{