aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2021-02-01 01:03:40 +0200
committerAhmad Samir <a.samirh78@gmail.com>2021-02-06 16:28:53 +0200
commit081f559031fed7cde755e006b226cf06f33bd0f8 (patch)
treef6334b19630d6d9df9074b493c5eaa3c7914954e /src/core
parent5d0dac047384e1f46e2de57f9b9ebf4f6fde0e26 (diff)
downloadkconfig-081f559031fed7cde755e006b226cf06f33bd0f8.tar.gz
kconfig-081f559031fed7cde755e006b226cf06f33bd0f8.tar.bz2
General code cleanup
Fix some clazy warnings, and some other minor code optimisations. NO_CHANGELOG
Diffstat (limited to 'src/core')
-rw-r--r--src/core/kconfig.cpp2
-rw-r--r--src/core/kconfiggroup.cpp8
-rw-r--r--src/core/kconfigwatcher.cpp3
-rw-r--r--src/core/ksharedconfig.cpp2
4 files changed, 6 insertions, 9 deletions
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp
index 2a3c614f..04608b0d 100644
--- a/src/core/kconfig.cpp
+++ b/src/core/kconfig.cpp
@@ -742,7 +742,7 @@ void KConfigPrivate::parseConfigFiles()
files << mBackend->filePath();
}
if (!isSimple()) {
- files = extraFiles.toList() + files;
+ files = QList<QString>(extraFiles.cbegin(), extraFiles.cend()) + files;
}
// qDebug() << "parsing local files" << files;
diff --git a/src/core/kconfiggroup.cpp b/src/core/kconfiggroup.cpp
index 14cbcab8..d900458f 100644
--- a/src/core/kconfiggroup.cpp
+++ b/src/core/kconfiggroup.cpp
@@ -1098,13 +1098,9 @@ void KConfigGroup::writeXdgListEntry(const char *key, const QStringList &list, W
// XXX List serialization being a separate layer from low-level escaping is
// probably a bug. No affected entries are defined, though.
- QStringList::ConstIterator it = list.constBegin();
- const QStringList::ConstIterator end = list.constEnd();
- for (; it != end; ++it) {
- QString val(*it);
+ for (QString val : list) { // clazy:exclude=range-loop
val.replace(QLatin1Char('\\'), QLatin1String("\\\\")).replace(QLatin1Char(';'), QLatin1String("\\;"));
- value += val;
- value += QLatin1Char(';');
+ value += val + QLatin1Char(';');
}
writeEntry(key, value, flags);
diff --git a/src/core/kconfigwatcher.cpp b/src/core/kconfigwatcher.cpp
index f63c39c1..c5aa6205 100644
--- a/src/core/kconfigwatcher.cpp
+++ b/src/core/kconfigwatcher.cpp
@@ -57,7 +57,8 @@ KConfigWatcher::KConfigWatcher(const KSharedConfig::Ptr &config):
QStringList watchedPaths;
watchedPaths << QLatin1Char('/') + d->m_config->name();
- for (const QString &file: d->m_config->additionalConfigSources()) {
+ const auto cfgSources = d->m_config->additionalConfigSources();
+ for (const QString &file : cfgSources) {
watchedPaths << QLatin1Char('/') + file;
}
if (d->m_config->openFlags() & KConfig::IncludeGlobals) {
diff --git a/src/core/ksharedconfig.cpp b/src/core/ksharedconfig.cpp
index 42b80fa7..cc6adeb9 100644
--- a/src/core/ksharedconfig.cpp
+++ b/src/core/ksharedconfig.cpp
@@ -77,7 +77,7 @@ KSharedConfigPtr KSharedConfig::openConfig(const QString &_fileName,
list->mainConfig = nullptr;
}
- for (auto cfg : qAsConst(*list)) {
+ for (auto *cfg : qAsConst(*list)) {
if (cfg->name() == fileName &&
cfg->d_ptr->openFlags == flags &&
cfg->locationType() == resType