diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-11-23 10:10:55 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-11-25 11:32:47 +0000 |
commit | 840e787175f0cec4714c3941c99c045a9717910d (patch) | |
tree | 763121944312cb28c53ab611932553c68cbbc08f /src/plugins/texteditor/generichighlighter | |
parent | 90fb7c79d8b0ec47e0ac661fd1185d11a06ba2ee (diff) | |
download | qt-creator-840e787175f0cec4714c3941c99c045a9717910d.tar.gz |
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>
Diffstat (limited to 'src/plugins/texteditor/generichighlighter')
-rw-r--r-- | src/plugins/texteditor/generichighlighter/highlighter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp index 877767f4c4..89150ac6d4 100644 --- a/src/plugins/texteditor/generichighlighter/highlighter.cpp +++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp @@ -415,8 +415,8 @@ void Highlighter::changeContext(const QString &contextName, const bool assignCurrent) { if (contextName.startsWith(kPop)) { - QStringList list = contextName.split(kHash, QString::SkipEmptyParts); - for (int i = 0; i < list.size(); ++i) { + const int count = contextName.splitRef(kHash, QString::SkipEmptyParts).size(); + for (int i = 0; i < count; ++i) { if (m_contexts.isEmpty()) { throw HighlighterException( QCoreApplication::translate("GenericHighlighter", "Reached empty context.")); |