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

Julien Nabet serval2412 at yahoo.fr
Sun Sep 17 15:54:31 UTC 2017


 dbaccess/source/core/dataaccess/databasecontext.cxx  |   15 ++++++++++-----
 dbaccess/source/core/dataaccess/databasedocument.cxx |    2 +-
 dbaccess/source/ext/macromigration/migrationlog.cxx  |    4 ++--
 dbaccess/source/ui/browser/genericcontroller.cxx     |   10 +++++-----
 dbaccess/source/ui/control/RelationControl.cxx       |    5 ++---
 5 files changed, 20 insertions(+), 16 deletions(-)

New commits:
commit e1e63bc2280f7964930cd6363bfc389226836937
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Sep 17 16:07:46 2017 +0200

    Replace some lists by vectors in dbaccess
    
    Change-Id: Ibf75bec826661fcff7d71e9e2f11884e498a299b
    Reviewed-on: https://gerrit.libreoffice.org/42382
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 4d2305a6b9cf..d065fff224a5 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -67,7 +67,7 @@
 #include <unotools/confignode.hxx>
 #include <unotools/pathoptions.hxx>
 #include <unotools/sharedunocomponent.hxx>
-#include <list>
+#include <vector>
 
 using namespace ::com::sun::star::sdbc;
 using namespace ::com::sun::star::sdb;
@@ -99,16 +99,21 @@ namespace dbaccess
         {
         private:
             Reference< XDesktop2 >               m_xDesktop;
-            std::list< const ODatabaseModelImpl* >  m_aDatabaseDocuments;
+            std::vector< const ODatabaseModelImpl* >  m_aDatabaseDocuments;
 
         public:
             explicit DatabaseDocumentLoader( const Reference<XComponentContext> & rxContext);
 
             void append(const ODatabaseModelImpl& _rModelImpl )
             {
-                m_aDatabaseDocuments.push_back(&_rModelImpl);
+                m_aDatabaseDocuments.emplace_back(&_rModelImpl);
             }
-            void remove(const ODatabaseModelImpl& _rModelImpl) { m_aDatabaseDocuments.remove(&_rModelImpl); }
+
+            void remove(const ODatabaseModelImpl& _rModelImpl)
+            {
+                m_aDatabaseDocuments.erase(std::find(m_aDatabaseDocuments.begin(), m_aDatabaseDocuments.end(), &_rModelImpl));
+            }
+
 
         private:
             // XTerminateListener
@@ -134,7 +139,7 @@ namespace dbaccess
 
         void SAL_CALL DatabaseDocumentLoader::queryTermination( const lang::EventObject& /*Event*/ )
         {
-            std::list< const ODatabaseModelImpl* > aCpy(m_aDatabaseDocuments);
+            std::vector< const ODatabaseModelImpl* > aCpy(m_aDatabaseDocuments);
             for( const auto& pCopy : aCpy )
             {
                 try
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index cad3cfb231b1..75b3b4f65189 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1786,7 +1786,7 @@ void ODatabaseDocument::disposing()
     // case they will be deleted - if they're C++ implementations, that is :).
     // Some of those implementations are offending enough to require the SolarMutex, which
     // means we should not release the last reference while our own mutex is locked ...
-    std::list< Reference< XInterface > > aKeepAlive;
+    std::vector< Reference< XInterface > > aKeepAlive;
 
     // SYNCHRONIZED ->
     ::osl::ClearableMutexGuard aGuard( m_aMutex );
diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx
index 65bd539236b8..caa8f5125e0e 100644
--- a/dbaccess/source/ext/macromigration/migrationlog.cxx
+++ b/dbaccess/source/ext/macromigration/migrationlog.cxx
@@ -28,7 +28,7 @@
 
 #include <vector>
 #include <map>
-#include <list>
+#include <vector>
 #include <algorithm>
 
 namespace dbmm
@@ -73,7 +73,7 @@ namespace dbmm
     typedef std::map< DocumentID, DocumentEntry > DocumentLogs;
 
     // ErrorLog
-    typedef std::list< MigrationError >   ErrorLog;
+    typedef std::vector< MigrationError >   ErrorLog;
 
     // MigrationLog_Data
     struct MigrationLog_Data
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 70d99d28a3da..03922795454b 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -1261,7 +1261,7 @@ namespace
 
 Sequence< DispatchInformation > SAL_CALL OGenericUnoController::getConfigurableDispatchInformation( ::sal_Int16 CommandGroup )
 {
-    std::list< DispatchInformation > aInformationList;
+    std::vector< DispatchInformation > aInformationVector;
     DispatchInformation aDispatchInfo;
     for (   SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.begin();
             aIter != m_aSupportedFeatures.end();
@@ -1271,13 +1271,13 @@ Sequence< DispatchInformation > SAL_CALL OGenericUnoController::getConfigurableD
         if ( sal_Int16( aIter->second.GroupId ) == CommandGroup )
         {
             aDispatchInfo = aIter->second;
-            aInformationList.push_back( aDispatchInfo );
+            aInformationVector.push_back( aDispatchInfo );
         }
     }
 
-    Sequence< DispatchInformation > aInformation( aInformationList.size() );
-    std::transform( aInformationList.begin(),
-        aInformationList.end(),
+    Sequence< DispatchInformation > aInformation( aInformationVector.size() );
+    std::transform( aInformationVector.begin(),
+        aInformationVector.end(),
         aInformation.getArray(),
         SGI_identity< DispatchInformation >()
     );
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index 6214f73aaf43..57a5e79f4064 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -35,8 +35,7 @@
 #include "helpids.h"
 #include <osl/diagnose.h>
 
-#include <list>
-using std::list;
+#include <vector>
 #include <utility>
 using std::pair;
 using std::make_pair;
@@ -65,7 +64,7 @@ namespace dbaui
         Reference< XPropertySet>                m_xSourceDef;
         Reference< XPropertySet>                m_xDestDef;
         enum opcode { DELETE, INSERT, MODIFY };
-        typedef list< pair < opcode, pair < OConnectionLineDataVec::size_type, OConnectionLineDataVec::size_type> > > ops_type;
+        typedef std::vector< pair < opcode, pair < OConnectionLineDataVec::size_type, OConnectionLineDataVec::size_type> > > ops_type;
         ops_type                                m_ops;
 
         void fillListBox(const Reference< XPropertySet>& _xDest);


More information about the Libreoffice-commits mailing list