From bf1df558461f21827eaad9d5d9541def784980a2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 8 Oct 2014 10:26:27 +0200 Subject: Don't use QByteArrayLiteral in comparisons For const char*s, operator== is overloaded, so comparing to a (C) string literal is efficient, since qstrcmp doesn't require the length of the strings to compare. OTOH, QByteArrayLiteral, when not using RVO, litters the code with QByteArray dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just compare with a (C) string literal instead. Change-Id: Id3bfdc89558ba51911f6317a7a73c287f96e6f24 Reviewed-by: Thiago Macieira --- .../themes/genericunix/qgenericunixthemes.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index 4c2051ebd0..b09dc8563c 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -624,16 +624,16 @@ QStringList QGenericUnixTheme::themeNames() QStringList result; if (QGuiApplication::desktopSettingsAware()) { const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - if (desktopEnvironment == QByteArrayLiteral("KDE")) { + if (desktopEnvironment == "KDE") { #ifndef QT_NO_SETTINGS result.push_back(QLatin1String(QKdeTheme::name)); #endif - } else if (desktopEnvironment == QByteArrayLiteral("GNOME") || - desktopEnvironment == QByteArrayLiteral("X-CINNAMON") || - desktopEnvironment == QByteArrayLiteral("UNITY") || - desktopEnvironment == QByteArrayLiteral("MATE") || - desktopEnvironment == QByteArrayLiteral("XFCE") || - desktopEnvironment == QByteArrayLiteral("LXDE")) { // Gtk-based desktops + } else if (desktopEnvironment == "GNOME" || + desktopEnvironment == "X-CINNAMON" || + desktopEnvironment == "UNITY" || + desktopEnvironment == "MATE" || + desktopEnvironment == "XFCE" || + desktopEnvironment == "LXDE") { // Gtk-based desktops // prefer the GTK2 theme implementation with native dialogs etc. result.push_back(QStringLiteral("gtk2")); // fallback to the generic Gnome theme if loading the GTK2 theme fails -- cgit v1.2.3