diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-12-04 20:35:16 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-07 19:48:57 +0100 |
commit | 8351e05bfc9e274ed46d96c87bd1d6517680ecac (patch) | |
tree | ef3655a98aeda4e1a809e047b7fe99a7428f1ad1 | |
parent | 6b80b0e35f2e1ac64cd4209609571c319eb12b09 (diff) | |
download | qttools-8351e05bfc9e274ed46d96c87bd1d6517680ecac.tar.gz qttools-8351e05bfc9e274ed46d96c87bd1d6517680ecac.tar.bz2 qttools-8351e05bfc9e274ed46d96c87bd1d6517680ecac.zip |
reserve space for joined string in stringifyNamespace()
Change-Id: Idc1aea8e98dcf56729e115757d0b133a9a4636bd
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
-rw-r--r-- | src/linguist/lupdate/cpp.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp index 50ab8b10..b28b9dc5 100644 --- a/src/linguist/lupdate/cpp.cpp +++ b/src/linguist/lupdate/cpp.cpp @@ -1042,6 +1042,10 @@ Namespace *CppParser::modifyNamespace(NamespaceList *namespaces, bool haveLast) QString CppParser::stringifyNamespace(int start, const NamespaceList &namespaces) { QString ret; + int l = 0; + for (int j = start; j < namespaces.count(); ++j) + l += namespaces.at(j).value().length(); + ret.reserve(l + qMax(0, (namespaces.count() - start - 1)) * 2); for (int i = start; i < namespaces.count(); ++i) { if (i > start) ret += QLatin1String("::"); |