From fef1b84f0a587dc285af6659cb64042e34e54223 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 30 Jul 2019 07:57:06 -0400 Subject: DolphinQt: Replace QStringLiteral with alternatives where applicable QStringLiterals generate a buffer so that during runtime there's very little cost to constructing a QString. However, this also means that duplicated strings cannot be optimized out into a single entry that gets referenced everywhere, taking up space in the binary. Rather than use QStringLiteral(""), we can just use QString{} (the default constructor) to signify the empty string. This gets rid of an unnecessary string buffer from being created, saving a tiny bit of space. While we're at it, we can just use the character overloads of particular functions when they're available instead of using a QString overload. The characters in this case are Latin-1 to begin with, so we can just specify the characters as QLatin1Char instances to use those overloads. These will automatically convert to QChar if needed, so this is safe. --- Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp') diff --git a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp index dda5915fc5..ee0e17e26a 100644 --- a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp +++ b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp @@ -280,8 +280,8 @@ void GeckoCodeWidget::UpdateList() const auto& code = m_gecko_codes[i]; auto* item = new QListWidgetItem(QString::fromStdString(code.name) - .replace(QStringLiteral("<"), QStringLiteral("<")) - .replace(QStringLiteral(">"), QStringLiteral(">"))); + .replace(QStringLiteral("<"), QChar::fromLatin1('<')) + .replace(QStringLiteral(">"), QChar::fromLatin1('>'))); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled); -- cgit v1.2.3