From 831a7e06c0f3df5b93ae27e3535fe64188ececb6 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 20 Jun 2015 17:28:12 +0200 Subject: [PATCH] qdoc: don't hold Location in QLists, don't even copy it Location is a self-referential type that is very expensive to copy. So don't. Instead, just remember the iterator, and use value()->location() (which returns a reference, so doesn't copy). Change-Id: I9a2b72b05b8051e793cf67179a0195f2f3551a10 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Martin Smith --- src/tools/qdoc/tree.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index d55367dce2..6c21d730c1 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -1142,18 +1142,15 @@ const DocumentNode* Tree::findDocumentNodeByTitle(const QString& title) const DocumentNodeMultiMap::const_iterator j = i; ++j; if (j != docNodesByTitle_.constEnd() && j.key() == i.key()) { - QList internalLocations; while (j != docNodesByTitle_.constEnd()) { if (j.key() == i.key() && j.value()->url().isEmpty()) { - internalLocations.append(j.value()->location()); break; // Just report one duplicate for now. } ++j; } - if (internalLocations.size() > 0) { + if (j != docNodesByTitle_.cend()) { i.value()->location().warning("This page title exists in more than one file: " + title); - foreach (const Location &location, internalLocations) - location.warning("[It also exists here]"); + j.value()->location().warning("[It also exists here]"); } } return i.value();