From 2fed43d8438b3fb751230aa2a8115de92789ccf3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 23 Jan 2016 02:04:48 +0100 Subject: Q*Application: don't allocate memory just to compare C strings Instead of creating a QByteArray, possibly normalizing a leading '--' (one allocation, plus possibly one copy), simply use the old 'ol str(n)cmp, skipping the first character if the argument starts with '--'. It also fixes parsing of -stylesheet and other options which were erroneously parsed using indexOf() != -1, when they should have used startsWith(). Also saves 504/742/522b in text size for QtCore/QtGui/QtWidgets, resp., on optimized GCC 5.3 Linux AMD64 builds. Change-Id: Ida868badac3fb9b77285417ee537c861ccc4fc06 Reviewed-by: Thiago Macieira --- src/widgets/kernel/qapplication.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index e20e820f12..91302d9e62 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -478,22 +478,24 @@ void QApplicationPrivate::process_cmdline() j = 1; for (i=1; i