From ee35bdce8f6b08922b4c9e0c0c838e5f2c4a79ad Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 22 Feb 2021 22:38:43 +0200 Subject: 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 --- src/core/kconfigini.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core/kconfigini.cpp') diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp index f47310d0..dd24a959 100644 --- a/src/core/kconfigini.cpp +++ b/src/core/kconfigini.cpp @@ -44,6 +44,8 @@ static QByteArray lookup(const KConfigIniBackend::BufferFragment fragment, QHash QString KConfigIniBackend::warningProlog(const QFile &file, int line) { + // %2 then %1 i.e. int before QString, so that the QString is last + // This avoids a wrong substitution if the fileName itself contains %1 return QStringLiteral("KConfigIni: In file %2, line %1: ").arg(line).arg(file.fileName()); } -- cgit v1.2.1