[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Nov 25 18:20:49 PST 2014


 sc/source/core/data/formulacell.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 628c0fac4abc09544f65a5070e415b3a05005449
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Nov 25 21:19:46 2014 -0500

    More efficient way to check & insert listener into ptr_map.
    
    Change-Id: I09ec8ed8f05621b72984a34f47db50d20ebd6c06
    (cherry picked from commit 42c8178ce73756f85fa41473bb16f667f7f564e9)

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index a34d3fb..b0a39da 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -556,12 +556,16 @@ sc::FormulaGroupAreaListener* ScFormulaCellGroup::getAreaListener(
 {
     AreaListenerKey aKey(rRange, bStartFixed, bEndFixed);
 
-    std::pair<AreaListenersType::iterator, bool> r =
-        mpImpl->maAreaListeners.insert(
-            aKey, new sc::FormulaGroupAreaListener(
+    AreaListenersType::iterator it = mpImpl->maAreaListeners.lower_bound(aKey);
+    if (it == mpImpl->maAreaListeners.end() || mpImpl->maAreaListeners.key_comp()(aKey, it->first))
+    {
+        // Insert a new one.
+        it = mpImpl->maAreaListeners.insert(
+            it, aKey, new sc::FormulaGroupAreaListener(
                 rRange, ppTopCell, mnLength, bStartFixed, bEndFixed));
+    }
 
-    return r.first->second;
+    return it->second;
 }
 
 void ScFormulaCellGroup::endAllGroupListening( ScDocument& rDoc )


More information about the Libreoffice-commits mailing list