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

Julien Nabet serval2412 at yahoo.fr
Sat Nov 11 08:59:14 UTC 2017


 sc/source/core/inc/addinlis.hxx  |    2 +-
 sc/source/core/tool/addinlis.cxx |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit d1bf03e40b195ea5b05db33ed9884f291c877572
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Nov 11 08:19:39 2017 +0100

    Replace list by vector in addinlis (sc)
    
    Change-Id: I38d83b7d611537ae903d7d63d2a04391eece11ae
    Reviewed-on: https://gerrit.libreoffice.org/44621
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/sc/source/core/inc/addinlis.hxx b/sc/source/core/inc/addinlis.hxx
index 5c657621eae9..7da698456046 100644
--- a/sc/source/core/inc/addinlis.hxx
+++ b/sc/source/core/inc/addinlis.hxx
@@ -41,7 +41,7 @@ private:
     css::uno::Any aResult;
     std::unique_ptr<ScAddInDocs> pDocs; // documents where this is used
 
-    static ::std::list<rtl::Reference<ScAddInListener>> aAllListeners;
+    static ::std::vector<rtl::Reference<ScAddInListener>> aAllListeners;
 
     // always allocated via CreateListener
     ScAddInListener( css::uno::Reference<css::sheet::XVolatileResult> const & xVR,
diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx
index 211605650f7b..2a56a6ca87f8 100644
--- a/sc/source/core/tool/addinlis.cxx
+++ b/sc/source/core/tool/addinlis.cxx
@@ -30,7 +30,7 @@ using namespace com::sun::star;
 
 SC_SIMPLE_SERVICE_INFO( ScAddInListener, "ScAddInListener", "stardiv.one.sheet.AddInListener" )
 
-::std::list<rtl::Reference<ScAddInListener>> ScAddInListener::aAllListeners;
+::std::vector<rtl::Reference<ScAddInListener>> ScAddInListener::aAllListeners;
 
 ScAddInListener* ScAddInListener::CreateListener(
                         const uno::Reference<sheet::XVolatileResult>& xVR, ScDocument* pDoc )
@@ -61,11 +61,11 @@ ScAddInListener* ScAddInListener::Get( const uno::Reference<sheet::XVolatileResu
     ScAddInListener* pLst = nullptr;
     sheet::XVolatileResult* pComp = xVR.get();
 
-    for(auto iter = aAllListeners.begin(); iter != aAllListeners.end(); ++iter)
+    for (auto const& listener : aAllListeners)
     {
-        if ( pComp == (*iter)->xVolRes.get() )
+        if ( pComp == listener->xVolRes.get() )
         {
-            pLst = iter->get();
+            pLst = listener.get();
             break;
         }
     }
@@ -108,9 +108,8 @@ void SAL_CALL ScAddInListener::modified( const css::sheet::ResultEvent& aEvent )
 
     Broadcast( ScHint(SfxHintId::ScDataChanged, ScAddress()) );
 
-    for ( ScAddInDocs::iterator it = pDocs->begin(); it != pDocs->end(); ++it )
+    for (auto const& pDoc : *pDocs)
     {
-        ScDocument* pDoc = *it;
         pDoc->TrackFormulas();
         pDoc->GetDocumentShell()->Broadcast( SfxHint( SfxHintId::ScDataChanged ) );
     }


More information about the Libreoffice-commits mailing list