diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-23 00:37:11 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-03-06 01:35:08 +0200 |
commit | 9d87348260316af729892c58bc29f159a173abf1 (patch) | |
tree | af81edda4bf441239f4ccc66dbfb533c5be26a47 /src/core/kconfig.cpp | |
parent | ee35bdce8f6b08922b4c9e0c0c838e5f2c4a79ad (diff) | |
download | kconfig-9d87348260316af729892c58bc29f159a173abf1.tar.gz kconfig-9d87348260316af729892c58bc29f159a173abf1.tar.bz2 |
Minor code optimisation
- Use more range-for loops where appropriate
- Use auto instead of the usually-long iterator type names
- Use cbegin/cend(), to match the std:: containers, less confusion
- Use qDeleteAll instead of a for loop
- Make a QRE with a long-ish pattern static
NO_CHANGELOG
Diffstat (limited to 'src/core/kconfig.cpp')
-rw-r--r-- | src/core/kconfig.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index 7f53847f..cc3700e1 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -125,7 +125,7 @@ void KConfigPrivate::copyGroup(const QByteArray &source, const QByteArray &desti // as dirty erroneously bool dirtied = false; - for (KEntryMap::ConstIterator entryMapIt(entryMap.constBegin()); entryMapIt != entryMap.constEnd(); ++entryMapIt) { + for (auto entryMapIt = entryMap.cbegin(); entryMapIt != entryMap.cend(); ++entryMapIt) { const QByteArray &group = entryMapIt.key().mGroup; if (!group.startsWith(source)) { // nothing to do @@ -266,7 +266,7 @@ QStringList KConfig::groupList() const Q_D(const KConfig); QSet<QString> groups; - for (KEntryMap::ConstIterator entryMapIt(d->entryMap.constBegin()); entryMapIt != d->entryMap.constEnd(); ++entryMapIt) { + for (auto entryMapIt = d->entryMap.cbegin(); entryMapIt != d->entryMap.cend(); ++entryMapIt) { const KEntryKey &key = entryMapIt.key(); const QByteArray group = key.mGroup; if (key.mKey.isNull() && !group.isEmpty() && group != "<default>" && group != "$Version") { @@ -283,7 +283,7 @@ QStringList KConfigPrivate::groupList(const QByteArray &group) const QByteArray theGroup = group + '\x1d'; QSet<QString> groups; - for (KEntryMap::ConstIterator entryMapIt(entryMap.constBegin()); entryMapIt != entryMap.constEnd(); ++entryMapIt) { + for (auto entryMapIt = entryMap.cbegin(); entryMapIt != entryMap.cend(); ++entryMapIt) { const KEntryKey &key = entryMapIt.key(); if (key.mKey.isNull() && key.mGroup.startsWith(theGroup)) { const QString groupname = QString::fromUtf8(key.mGroup.mid(theGroup.length())); |