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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 1 06:18:10 UTC 2018


 ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx |   19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

New commits:
commit df9e895763d7887baef7fe14c035aff25b99be7e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Sep 28 11:24:26 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 1 08:17:49 2018 +0200

    loplugin:useuniqueptr in hierarchy_ucp::DataSupplier_Impl
    
    Change-Id: I56259038649419b5ef02d911c20358d8a8d56917
    Reviewed-on: https://gerrit.libreoffice.org/61118
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx
index f7d9a8daec73..13e6eea30ead 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx
@@ -57,7 +57,7 @@ struct ResultListEntry
 // ResultList.
 
 
-typedef std::vector< ResultListEntry* > ResultList;
+typedef std::vector< std::unique_ptr<ResultListEntry> > ResultList;
 
 
 // struct DataSupplier_Impl.
@@ -84,22 +84,9 @@ struct DataSupplier_Impl
                      rContent->getProvider().get() ),
                  rContent->getIdentifier()->getContentIdentifier() ),
       m_nOpenMode( nOpenMode ), m_bCountFinal( false ) {}
-    ~DataSupplier_Impl();
 };
 
 
-DataSupplier_Impl::~DataSupplier_Impl()
-{
-    ResultList::const_iterator it  = m_aResults.begin();
-    ResultList::const_iterator end = m_aResults.end();
-
-    while ( it != end )
-    {
-        delete *it;
-        ++it;
-    }
-}
-
 }
 
 
@@ -247,7 +234,7 @@ bool HierarchyResultSetDataSupplier::getResult( sal_uInt32 nIndex )
         const HierarchyEntryData& rResult = *m_pImpl->m_aIterator;
         if ( checkResult( rResult ) )
         {
-            m_pImpl->m_aResults.push_back( new ResultListEntry( rResult ) );
+            m_pImpl->m_aResults.emplace_back( new ResultListEntry( rResult ) );
 
             if ( nPos == nIndex )
             {
@@ -294,7 +281,7 @@ sal_uInt32 HierarchyResultSetDataSupplier::totalCount()
     {
         const HierarchyEntryData& rResult = *m_pImpl->m_aIterator;
         if ( checkResult( rResult ) )
-            m_pImpl->m_aResults.push_back( new ResultListEntry( rResult ) );
+            m_pImpl->m_aResults.emplace_back( new ResultListEntry( rResult ) );
     }
 
     m_pImpl->m_bCountFinal = true;


More information about the Libreoffice-commits mailing list