From 8dc024adc64ba667ede2854b2411775a9e18cafc Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 28 Feb 2015 15:18:11 +0100 Subject: QtCore: replace QStringLiteral with QLatin1String when appending It makes little sense to use QStringLiteral for strings which are immediately appended to, or which are appended to other strings, because no dynamic memory allocation is saved by doing so. But if the only advantage of QStringLiteral does not apply, all its disadvantages dominate, to wit: injection of calls to qstring dtor, non-sharability of data between C strings and QStringLiterals and among QStringLiterals, and doubled storage requirements. Fix by replacing QStringLiteral with QLatin1String. Saves 1156B in text size on stripped optimized Linux AMD64 GCC 4.9 builds. Change-Id: If805e431f570ec1d2ac62c548f516f1b17390c3a Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qcommandlineparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools/qcommandlineparser.cpp') diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index a9d3c7f5d85..6587d900d2e 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -1029,7 +1029,7 @@ QString QCommandLineParser::helpText() const static QString wrapText(const QString &names, int longestOptionNameString, const QString &description) { const QLatin1Char nl('\n'); - QString text = QStringLiteral(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' '); + QString text = QLatin1String(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' '); const int indent = text.length(); int lineStart = 0; int lastBreakable = -1; -- cgit v1.2.3