diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-04-06 15:23:58 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-04-26 10:31:19 +0000 |
commit | 1be53f4e143d417d60cd1f9a292193dab59b5b20 (patch) | |
tree | efc9f54af4d646d9e7d5618e3c2688d9442bbc71 /src/plugins/qmltooling/qmldbg_native | |
parent | 84f61dd2d2b0140814b39a2c5238a6e31c49abd7 (diff) |
Use QStringRef to optimize memory allocation
Replace substring functions that return QString with
corresponding functions that return QStringRef where
it's possible.
Create QString from QStringRef only where necessary.
While touching the code, also port loops to C++11 style.
Change-Id: I04c99b24ea6afd3715e3edf9ea00bfab838fd53c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_native')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index cc0118f0c2..3145601612 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -49,6 +49,7 @@ #include <QtCore/qjsonobject.h> #include <QtCore/qjsonvalue.h> #include <QtCore/qpointer.h> +#include <QtCore/qvector.h> //#define TRACE_PROTOCOL(s) qDebug() << s #define TRACE_PROTOCOL(s) @@ -182,24 +183,21 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector() : m_blockingMode(false) { const QString args = commandLineArguments(); - const QStringList lstjsDebugArguments = args.split(QLatin1Char(',')); + const auto lstjsDebugArguments = args.splitRef(QLatin1Char(',')); QStringList services; - QStringList::const_iterator argsItEnd = lstjsDebugArguments.cend(); - QStringList::const_iterator argsIt = lstjsDebugArguments.cbegin(); - for (; argsIt != argsItEnd; ++argsIt) { - const QString strArgument = *argsIt; + for (const QStringRef &strArgument : lstjsDebugArguments) { if (strArgument == QLatin1String("block")) { m_blockingMode = true; } else if (strArgument == QLatin1String("native")) { // Ignore. This is used to signal that this connector // should be loaded and that has already happened. } else if (strArgument.startsWith(QLatin1String("services:"))) { - services.append(strArgument.mid(9)); + services.append(strArgument.mid(9).toString()); } else if (!services.isEmpty()) { - services.append(strArgument); + services.append(strArgument.toString()); } else { qWarning("QML Debugger: Invalid argument \"%s\" detected. Ignoring the same.", - qUtf8Printable(strArgument)); + strArgument.toUtf8().constData()); } } setServices(services); |