Use QString::splitRef() instead of QString::split()

Avoid string allocation where it seems feasible.

Change-Id: I61b23d4ef8a459f5aa77727a75f4e1d2b140da3b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Friedemann Kleint
2016-11-23 10:10:55 +01:00
parent 90fb7c79d8
commit 840e787175
11 changed files with 27 additions and 24 deletions

View File

@@ -3515,14 +3515,14 @@ void GdbEngine::handleRegisterListing(const DebuggerResponse &response)
m_registers.clear();
QStringList lines = response.consoleStreamOutput.split('\n');
for (int i = 1; i < lines.size(); ++i) {
QStringList parts = QString(lines.at(i)).split(' ', QString::SkipEmptyParts);
const QVector<QStringRef> parts = QString(lines.at(i)).splitRef(' ', QString::SkipEmptyParts);
if (parts.size() < 7)
continue;
int gdbRegisterNumber = parts.at(1).toInt();
Register reg;
reg.name = parts.at(0);
reg.name = parts.at(0).toString();
reg.size = parts.at(4).toInt();
reg.reportedType = parts.at(5);
reg.reportedType = parts.at(5).toString();
m_registers[gdbRegisterNumber] = reg;
}
}
@@ -3895,7 +3895,7 @@ static SourcePathMap mergeStartParametersSourcePathMap(const DebuggerRunParamete
void GdbEngine::startGdb(const QStringList &args)
{
const QString tests = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_TESTS"));
foreach (const QString &test, tests.split(','))
foreach (const QStringRef &test, tests.splitRef(QLatin1Char(',')))
m_testCases.insert(test.toInt());
foreach (int test, m_testCases)
showMessage("ENABLING TEST CASE: " + QString::number(test));