From 17c179566d764d9a55b6ae98006495133bcffdbf Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 23 Jun 2021 12:34:53 +0200 Subject: KConfig: sort keys in keyListImpl() so unittests can rely on it The code was using a QSet (hash-based), use a std::set instead for unicity, it gives us sorting for free. We probably want to do the same in groupList(), but that's separate. --- src/core/kconfig.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index 9b8d2e62..b4777575 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -31,6 +31,8 @@ #include #include +#include + #if KCONFIG_USE_DBUS #include #include @@ -347,14 +349,14 @@ QStringList KConfigPrivate::keyListImpl(const QByteArray &theGroup) const if (it != theEnd) { ++it; // advance past the special group entry marker - QSet tmp; + std::set tmp; // unique set, sorted for unittests for (; it != theEnd && it.key().mGroup == theGroup; ++it) { const KEntryKey &key = it.key(); if (!key.mKey.isNull() && !it->bDeleted) { - tmp << QString::fromUtf8(key.mKey); + tmp.insert(QString::fromUtf8(key.mKey)); } } - keys = tmp.values(); + keys = QList(tmp.begin(), tmp.end()); } return keys; -- cgit v1.2.1