From 187136265d26c014e842550c2f1fc5997736e4fa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 27 May 2021 15:49:15 +0200 Subject: 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 --- 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(-) (limited to 'ucb') 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 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 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 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 > maData; + std::deque maData; public: EventList(){} @@ -77,9 +77,9 @@ public: sal_uInt32 Count() { return static_cast(maData.size()); } void AddEvent( sal_IntPtr nType, sal_Int32 nPos ); - void Insert( std::unique_ptr 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 ]; } }; -- cgit