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

Julien Nabet serval2412 at yahoo.fr
Sun Nov 12 07:56:00 UTC 2017


 sd/source/ui/unoidl/unowcntr.cxx |   20 ++++++++++----------
 sd/source/ui/unoidl/unowcntr.hxx |    6 ++----
 2 files changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 3ca4d1169c1b6d35eecc980251d6d89ff120ee70
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Nov 11 21:22:01 2017 +0100

    Replace list by vector for weakRef (sd)
    
    Change-Id: I4c303b402e4b4d7e27cd42acf88dda90f0c8b119
    Reviewed-on: https://gerrit.libreoffice.org/44643
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/sd/source/ui/unoidl/unowcntr.cxx b/sd/source/ui/unoidl/unowcntr.cxx
index d71f7cb01c86..bb1687b07362 100644
--- a/sd/source/ui/unoidl/unowcntr.cxx
+++ b/sd/source/ui/unoidl/unowcntr.cxx
@@ -29,22 +29,22 @@ SvUnoWeakContainer::SvUnoWeakContainer() throw()
 
 SvUnoWeakContainer::~SvUnoWeakContainer() throw()
 {
-    for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ++it )
-            delete *it;
-    maList.clear();
+    for (auto const& elem : maVector)
+            delete elem;
+    maVector.clear();
 }
 
 /** inserts the given ref into this container */
 void SvUnoWeakContainer::insert( const uno::WeakReference< uno::XInterface >& xRef ) throw()
 {
-    for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); )
+    for ( auto it = maVector.begin(); it != maVector.end(); )
     {
         uno::WeakReference< uno::XInterface >* pRef = *it;
         uno::Reference< uno::XInterface > xTestRef( *pRef );
         if ( !xTestRef.is() )
         {
             delete pRef;
-            it = maList.erase( it );
+            it = maVector.erase( it );
         }
         else
         {
@@ -53,7 +53,7 @@ void SvUnoWeakContainer::insert( const uno::WeakReference< uno::XInterface >& xR
             ++it;
         }
     }
-    maList.push_back( new uno::WeakReference< uno::XInterface >( xRef ) );
+    maVector.push_back( new uno::WeakReference< uno::XInterface >( xRef ) );
 }
 
 /** searches the container for a ref that returns true on the given
@@ -65,14 +65,14 @@ bool SvUnoWeakContainer::findRef(
     weakref_searchfunc pSearchFunc
 )
 {
-    for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); )
+    for ( auto it = maVector.begin(); it != maVector.end(); )
     {
         uno::WeakReference< uno::XInterface >* pRef = *it;
         uno::Reference< uno::XInterface > xTestRef( *pRef );
         if ( !xTestRef.is() )
         {
             delete pRef;
-            it = maList.erase( it );
+            it = maVector.erase( it );
         }
         else
         {
@@ -89,9 +89,9 @@ bool SvUnoWeakContainer::findRef(
 
 void SvUnoWeakContainer::dispose()
 {
-    for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ++it )
+    for (auto const& elem : maVector)
     {
-        uno::WeakReference< uno::XInterface >* pRef = *it;
+        uno::WeakReference< uno::XInterface >* pRef = elem;
         uno::Reference< uno::XInterface > xTestRef( *pRef );
         if ( xTestRef.is() )
         {
diff --git a/sd/source/ui/unoidl/unowcntr.hxx b/sd/source/ui/unoidl/unowcntr.hxx
index 15cca90bda85..787c81d3c3b3 100644
--- a/sd/source/ui/unoidl/unowcntr.hxx
+++ b/sd/source/ui/unoidl/unowcntr.hxx
@@ -21,16 +21,14 @@
 #define INCLUDED_SD_SOURCE_UI_UNOIDL_UNOWCNTR_HXX
 
 #include <cppuhelper/weakref.hxx>
-#include <list>
+#include <vector>
 
 typedef bool (*weakref_searchfunc)( const css::uno::WeakReference< css::uno::XInterface >& xRef, void const * pSearchData );
 
-typedef ::std::list< css::uno::WeakReference< css::uno::XInterface >* > WeakRefList;
-
 class SvUnoWeakContainer
 {
 private:
-    WeakRefList maList;
+    std::vector< css::uno::WeakReference< css::uno::XInterface >* > maVector;
 
 public:
     SvUnoWeakContainer() throw();


More information about the Libreoffice-commits mailing list