[Libreoffice-commits] core.git: sfx2/source

Caolán McNamara caolanm at redhat.com
Mon Nov 14 09:49:57 UTC 2016


 sfx2/source/dialog/templdlg.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 40f8c14be28aeb78fe758264b43a255d2bfd4938
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 14 09:48:36 2016 +0000

    minor opt tweaks
    
    Change-Id: I418d0e04f8d4373c0d9f1f106ac0cc7779029802

diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 3bd42b2..bb25c2b 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -543,17 +543,20 @@ StyleTreeArr_Impl& MakeTree_Impl(StyleTreeArr_Impl& rArr)
 
     std::unordered_map<OUString, StyleTree_Impl*, OUStringHash> styleFinder;
     styleFinder.reserve(rArr.size());
-    for(auto pEntry : rArr)
+    for (const auto& pEntry : rArr)
     {
         styleFinder.emplace(pEntry->getName(), pEntry);
     }
 
     // Arrange all under their Parents
-    for(auto pEntry : rArr)
+    for (const auto& pEntry : rArr)
     {
-        if(pEntry->HasParent() && styleFinder.find(pEntry->getParent()) != styleFinder.end())
+        if (!pEntry->HasParent())
+            continue;
+        auto it = styleFinder.find(pEntry->getParent());
+        if (it != styleFinder.end())
         {
-            StyleTree_Impl* pCmp = styleFinder[pEntry->getParent()];
+            StyleTree_Impl* pCmp = it->second;
             // Insert child entries sorted
             auto iPos = std::lower_bound(pCmp->getChildren().begin(), pCmp->getChildren().end(), pEntry,
                 [&aSorter](StyleTree_Impl* pEntry1, StyleTree_Impl* pEntry2) { return aSorter.compare(pEntry1->getName(), pEntry2->getName()) < 0; });


More information about the Libreoffice-commits mailing list