diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-22 22:38:43 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-03-06 01:33:45 +0200 |
commit | ee35bdce8f6b08922b4c9e0c0c838e5f2c4a79ad (patch) | |
tree | 591898b2b603d84329fe335675d054ad3e28bbd2 /src/kreadconfig/kwriteconfig.cpp | |
parent | 36f12b207f6a08f6d5fda7d53246a8abe70edf63 (diff) | |
download | kconfig-ee35bdce8f6b08922b4c9e0c0c838e5f2c4a79ad.tar.gz kconfig-ee35bdce8f6b08922b4c9e0c0c838e5f2c4a79ad.tar.bz2 |
Optimise string operations a bit
- Use QString::arg(Args...) instead of .arg().arg()
- Use QLatin1String for string comparisons, should be faster
- Use QLatin1String::arg() for better readability
- Add the comment dfaure suggested in the MR, to explain why it's '2%'
then '%1' in a QString().arg().arg()
NO_CHANGELOG
Diffstat (limited to 'src/kreadconfig/kwriteconfig.cpp')
-rw-r--r-- | src/kreadconfig/kwriteconfig.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kreadconfig/kwriteconfig.cpp b/src/kreadconfig/kwriteconfig.cpp index a8a1ee4e..67d9637e 100644 --- a/src/kreadconfig/kwriteconfig.cpp +++ b/src/kreadconfig/kwriteconfig.cpp @@ -69,15 +69,15 @@ int main(int argc, char **argv) if (del) { cfgGroup.deleteEntry(key); - } else if (type == QStringLiteral("bool")) { + } else if (type == QLatin1String{"bool"}) { // For symmetry with kreadconfig we accept a wider range of values as true than Qt /* clang-format off */ - bool boolvalue = value == QStringLiteral("true") - || value == QStringLiteral("on") - || value == QStringLiteral("yes") - || value == QStringLiteral("1"); /* clang-format on */ + bool boolvalue = value == QLatin1String{"true"} + || value == QLatin1String{"on"} + || value == QLatin1String{"yes"} + || value == QLatin1String{"1"}; /* clang-format on */ cfgGroup.writeEntry(key, boolvalue); - } else if (type == QStringLiteral("path")) { + } else if (type == QLatin1String{"path"}) { cfgGroup.writePathEntry(key, value); } else { cfgGroup.writeEntry(key, value); |