diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-10-08 11:35:24 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-10-09 09:42:00 +0200 |
commit | 1a5c0b26d062a380fef1bb038a9d96cde7556dc6 (patch) | |
tree | 10f36942a89365b0bea350dab8041801514a2495 /src/plugins/printsupport | |
parent | bf1df558461f21827eaad9d5d9541def784980a2 (diff) | |
download | qtbase-1a5c0b26d062a380fef1bb038a9d96cde7556dc6.tar.gz |
Don't use QStringLiteral in comparisons
For QLatin1String, operator== is overloaded, so comparing to a latin-1
(C) string literal is efficient, since strlen() is comparatively fast.
OTOH, QStringLiteral, when not using RVO, litters the code with
QString dtor calls, which are not inline. Worse, absent lambdas,
it even allocates memory.
So, just compare using QLatin1String instead.
Change-Id: I7af3bf3a67c55dae33ffaf9922d004fa168a3f9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/printsupport')
-rw-r--r-- | src/plugins/printsupport/cups/main.cpp | 2 | ||||
-rw-r--r-- | src/plugins/printsupport/windows/main.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/printsupport/cups/main.cpp b/src/plugins/printsupport/cups/main.cpp index 5391b4dbeb..5a7b9d7440 100644 --- a/src/plugins/printsupport/cups/main.cpp +++ b/src/plugins/printsupport/cups/main.cpp @@ -58,7 +58,7 @@ QStringList QCupsPrinterSupportPlugin::keys() const QPlatformPrinterSupport *QCupsPrinterSupportPlugin::create(const QString &key) { - if (key.compare(key, QStringLiteral("cupsprintersupport"), Qt::CaseInsensitive) == 0) + if (key.compare(key, QLatin1String("cupsprintersupport"), Qt::CaseInsensitive) == 0) return new QCupsPrinterSupport; return 0; } diff --git a/src/plugins/printsupport/windows/main.cpp b/src/plugins/printsupport/windows/main.cpp index 2f083ae668..149fe7d138 100644 --- a/src/plugins/printsupport/windows/main.cpp +++ b/src/plugins/printsupport/windows/main.cpp @@ -50,7 +50,7 @@ public: QPlatformPrinterSupport *QWindowsPrinterSupportPlugin::create(const QString &key) { - if (key.compare(key, QStringLiteral("windowsprintsupport"), Qt::CaseInsensitive) == 0) + if (key.compare(key, QLatin1String("windowsprintsupport"), Qt::CaseInsensitive) == 0) return new QWindowsPrinterSupport; return 0; } |