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

Kohei Yoshida kohei.yoshida at collabora.com
Tue Nov 25 18:19:33 PST 2014


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

New commits:
commit 42c8178ce73756f85fa41473bb16f667f7f564e9
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

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 5574c90..c9c0616 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -557,12 +557,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