summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qsettings_mac.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-05-20 19:03:42 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-06-20 04:39:15 +0000
commit657e8ffb9ecdf451b9db85dd5dfbc820d2ac3ca5 (patch)
tree03ba03e805207af7ca7e6d6274a06e2ee410719c /src/corelib/io/qsettings_mac.cpp
parent669487fe9549a896ea4ec3c63fa7ad8585e74b63 (diff)
QSettings: replace a QMap with a QList
The QMap<QString, QString> was only used to create a sorted, unique list of keys. The associativeness was never used (the value was always the null QString). Better to use a QStringList instead and sort-unique the whole thing at the end. Saves ~1.6K in text size on Linux AMD64 GCC 4.9 release C++11 builds, and a tremendous amount of heap allocations. Change-Id: Idf749dd8924b3894e436aa1cee0304002b898975 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/io/qsettings_mac.cpp')
-rw-r--r--src/corelib/io/qsettings_mac.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 083722869f..1ad198b990 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -491,7 +491,7 @@ bool QMacSettingsPrivate::get(const QString &key, QVariant *value) const
QStringList QMacSettingsPrivate::children(const QString &prefix, ChildSpec spec) const
{
- QMap<QString, QString> result;
+ QStringList result;
int startPos = prefix.size();
for (int i = 0; i < numDomains; ++i) {
@@ -513,7 +513,10 @@ QStringList QMacSettingsPrivate::children(const QString &prefix, ChildSpec spec)
if (!fallbacks)
break;
}
- return result.keys();
+ std::sort(result.begin(), result.end());
+ result.erase(std::unique(result.begin(), result.end()),
+ result.end());
+ return result;
}
void QMacSettingsPrivate::clear()