summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/generichighlighter
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-11-23 10:10:55 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2016-11-25 11:32:47 +0000
commit840e787175f0cec4714c3941c99c045a9717910d (patch)
tree763121944312cb28c53ab611932553c68cbbc08f /src/plugins/texteditor/generichighlighter
parent90fb7c79d8b0ec47e0ac661fd1185d11a06ba2ee (diff)
downloadqt-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.cpp4
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."));