diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-03 15:28:38 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-06 22:11:41 +0200 |
commit | dc878289c01011c59615746655b4e78d4bc90b91 (patch) | |
tree | a5c547a6d05e46efac6e17725d75343b40e78440 /src/core/kauthorized.cpp | |
parent | bb16fda4e5f7caa9e892540ec69a202cec9eb16f (diff) | |
download | kconfig-dc878289c01011c59615746655b4e78d4bc90b91.tar.gz kconfig-dc878289c01011c59615746655b4e78d4bc90b91.tar.bz2 |
Minor code optimisations
- Use a global var for a QString that's used many times
- Break up long-all-cap variable names, it makes it harder to read (and
I've fixed one typo in one of those ALLCAPS)
- Fix some clazy warnings, make global QString objects in unit tests
static (so that the compiler doesn't create symbols for them, it doesn't
matter in a unit test but KF code acts as a reference sometimes that
others copy from, tip from dfaure)
- Add TODO note about changing kconfig_compiler to generate C++ code that
uses multi-arg QString::arg(QString, QString, QString) instead of
QString::arg().arg()
- More const; more QString::at() instead of operator[] where appropriate
- Use a ternary where it makes the code more readable (and uses less lines :))
NO_CHANGELOG
Diffstat (limited to 'src/core/kauthorized.cpp')
-rw-r--r-- | src/core/kauthorized.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/kauthorized.cpp b/src/core/kauthorized.cpp index 3a06c887..1abd83eb 100644 --- a/src/core/kauthorized.cpp +++ b/src/core/kauthorized.cpp @@ -300,13 +300,13 @@ KCONFIGCORE_EXPORT void loadUrlActionRestrictions(const KConfigGroup &cg) continue; } const QByteArray action = rule[0].toLatin1(); - QString refProt = rule[1]; - QString refHost = rule[2]; + const QString refProt = rule[1]; + const QString refHost = rule[2]; QString refPath = rule[3]; - QString urlProt = rule[4]; - QString urlHost = rule[5]; + const QString urlProt = rule[4]; + const QString urlHost = rule[5]; QString urlPath = rule[6]; - bool bEnabled = (rule[7].toLower() == QLatin1String("true")); + const bool bEnabled = (rule[7].toLower() == QLatin1String("true")); if (refPath.startsWith(QLatin1String("$HOME"))) { refPath.replace(0, 5, QDir::homePath()); |