diff options
| author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-07-22 15:07:21 +0200 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-07-24 08:51:12 +0000 |
| commit | dbf4c6290f90f81ecda6f5f956f9f859222496ac (patch) | |
| tree | 2729d5b82306019cd063bb81e72e7f440c875747 /src/tools/qdoc/cppcodemarker.cpp | |
| parent | 5fd9fe02ff14438a2d0c93789be138a58583dbe8 (diff) | |
Optimize CppCodeMarker::addMarkUp further
This avoids a couple of more string/memory
allocations, giving another 5% speed gain
for qdoc --prepare.
Change-Id: I455f615bb4388d883dca5a8cd31bf50629db23e0
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/cppcodemarker.cpp')
| -rw-r--r-- | src/tools/qdoc/cppcodemarker.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index 6060339762c..868b2492905 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -929,8 +929,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, } else if (keywords.contains(ident)) { tag = QStringLiteral("keyword"); } else if (braceDepth == 0 && parenDepth == 0) { - if (QString(code.unicode() + i - 1, code.length() - (i - 1)) - .indexOf(findFunctionRegExp) == 0) + if (code.indexOf(findFunctionRegExp, i - 1) == i - 1) tag = QStringLiteral("func"); target = true; } @@ -1083,7 +1082,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, out += QStringLiteral(">"); } - out += protect(text); + appendProtectedString(&out, text); if (!tag.isEmpty()) { out += QStringLiteral("</@"); @@ -1093,7 +1092,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, } if (start < code.length()) { - out += protect(code.midRef(start)); + appendProtectedString(&out, code.midRef(start)); } return out; |
