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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu May 27 19:26:38 UTC 2021


 ucb/source/sorter/sortdynres.cxx |   24 ++++++++++++------------
 ucb/source/sorter/sortresult.cxx |   12 ++++++------
 ucb/source/sorter/sortresult.hxx |    6 +++---
 3 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 187136265d26c014e842550c2f1fc5997736e4fa
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu May 27 15:49:15 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 27 21:25:58 2021 +0200

    flatten EventList data a little
    
    no need to allocate the ListAction objects separately
    
    Change-Id: I02a591265c0da64d94a118b29bd0c4960d19a763
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116264
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx
index 5dc7694e107e..100dfa73ccbd 100644
--- a/ucb/source/sorter/sortdynres.cxx
+++ b/ucb/source/sorter/sortdynres.cxx
@@ -306,13 +306,13 @@ void SortedDynamicResultSet::impl_notify( const ListEvent& Changes )
                         aWelcome.Old = mxTwo.get();
                         aWelcome.New = mxOne.get();
 
-                        std::unique_ptr<ListAction> pWelcomeAction(new ListAction);
-                        pWelcomeAction->ActionInfo <<= aWelcome;
-                        pWelcomeAction->Position = 0;
-                        pWelcomeAction->Count = 0;
-                        pWelcomeAction->ListActionType = ListActionType::WELCOME;
+                        ListAction aWelcomeAction;
+                        aWelcomeAction.ActionInfo <<= aWelcome;
+                        aWelcomeAction.Position = 0;
+                        aWelcomeAction.Count = 0;
+                        aWelcomeAction.ListActionType = ListActionType::WELCOME;
 
-                        maActions.Insert( std::move(pWelcomeAction) );
+                        maActions.Insert( aWelcomeAction );
                     }
                     else
                     {
@@ -388,7 +388,7 @@ void SortedDynamicResultSet::SendNotify()
 
         for ( sal_Int32 i=0; i<nCount; i++ )
         {
-            pActionList[ i ] = *(maActions.GetAction( i ));
+            pActionList[ i ] = maActions.GetAction( i );
         }
 
         ListEvent aNewEvent;
@@ -461,12 +461,12 @@ void EventList::Clear()
 
 void EventList::AddEvent( sal_IntPtr nType, sal_Int32 nPos )
 {
-    std::unique_ptr<ListAction> pAction(new ListAction);
-    pAction->Position = nPos;
-    pAction->Count = 1;
-    pAction->ListActionType = nType;
+    ListAction aAction;
+    aAction.Position = nPos;
+    aAction.Count = 1;
+    aAction.ListActionType = nType;
 
-    Insert( std::move(pAction) );
+    Insert( aAction );
 }
 
 // SortedDynamicResultSetListener
diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx
index 4a4e5956e2d8..b32844368c38 100644
--- a/ucb/source/sorter/sortresult.cxx
+++ b/ucb/source/sorter/sortresult.cxx
@@ -1619,12 +1619,12 @@ void SortedResultSet::ResortModified( EventList* pList )
 
                     m_O2S[pData->mnCurPos] = nNewPos;
 
-                    std::unique_ptr<ListAction> pAction(new ListAction);
-                    pAction->Position = nCurPos;
-                    pAction->Count = 1;
-                    pAction->ListActionType = ListActionType::MOVED;
-                    pAction->ActionInfo <<= nNewPos-nCurPos;
-                    pList->Insert( std::move(pAction) );
+                    ListAction aAction;
+                    aAction.Position = nCurPos;
+                    aAction.Count = 1;
+                    aAction.ListActionType = ListActionType::MOVED;
+                    aAction.ActionInfo <<= nNewPos-nCurPos;
+                    pList->Insert( aAction );
                 }
                 pList->AddEvent( ListActionType::PROPERTIES_CHANGED, nNewPos );
             }
diff --git a/ucb/source/sorter/sortresult.hxx b/ucb/source/sorter/sortresult.hxx
index 12ea3b78bdf1..bbef157df5d0 100644
--- a/ucb/source/sorter/sortresult.hxx
+++ b/ucb/source/sorter/sortresult.hxx
@@ -69,7 +69,7 @@ public:
 
 class EventList
 {
-    std::deque < std::unique_ptr<css::ucb::ListAction> > maData;
+    std::deque <css::ucb::ListAction > maData;
 
 public:
                      EventList(){}
@@ -77,9 +77,9 @@ public:
     sal_uInt32      Count() { return static_cast<sal_uInt32>(maData.size()); }
 
     void            AddEvent( sal_IntPtr nType, sal_Int32 nPos );
-    void            Insert( std::unique_ptr<css::ucb::ListAction> pAction ) { maData.push_back( std::move(pAction) ); }
+    void            Insert( const css::ucb::ListAction& rAction ) { maData.push_back( rAction ); }
     void            Clear();
-    css::ucb::ListAction*     GetAction( sal_Int32 nIndex ) { return maData[ nIndex ].get(); }
+    css::ucb::ListAction&  GetAction( sal_Int32 nIndex ) { return maData[ nIndex ]; }
 };
 
 


More information about the Libreoffice-commits mailing list