diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-10-08 12:41:28 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-10-09 09:42:11 +0200 |
commit | 1cc06b2e9499b65ac30bbc667cf99e0077c48af7 (patch) | |
tree | 0d61af1521063330d71eb97a37e392e3a9e63d2f /src/gui | |
parent | 1a5c0b26d062a380fef1bb038a9d96cde7556dc6 (diff) |
Don't use QStringLiteral in startsWith/endsWidth
For QLatin1String, startsWith/endsWith 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 use QLatin1String instead.
Change-Id: I7eaf464c67b55116f970fe7f58a85f19ce4d254e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpagesize.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 3e50ce44c4..5233d76d7b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1201,7 +1201,7 @@ void QGuiApplicationPrivate::eventDispatcherReady() static bool runningUnderDebugger() { const QFileInfo parentProcExe(QStringLiteral("/proc/") + QString::number(getppid()) + QStringLiteral("/exe")); - return parentProcExe.isSymLink() && parentProcExe.symLinkTarget().endsWith(QStringLiteral("/gdb")); + return parentProcExe.isSymLink() && parentProcExe.symLinkTarget().endsWith(QLatin1String("/gdb")); } #endif diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index faf3e3941e..2753d9351c 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -396,9 +396,9 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match return QPageSize::Custom; QString key = ppdKey; // Remove any Rotated or Tranverse modifiers - if (key.endsWith(QStringLiteral("Rotated"))) + if (key.endsWith(QLatin1String("Rotated"))) key.chop(7); - else if (key.endsWith(QStringLiteral(".Transverse"))) + else if (key.endsWith(QLatin1String(".Transverse"))) key.chop(11); for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) { if (QLatin1String(qt_pageSizes[i].mediaOption) == key) { |