diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 15:49:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 21:25:58 +0200 |
commit | 187136265d26c014e842550c2f1fc5997736e4fa (patch) | |
tree | 0862e11b69650b6cb5a85e58a304eb9eb8f75fd3 /ucb | |
parent | 7c1dbb665a3eb7859164dbf83c245b7f450c9028 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/sorter/sortdynres.cxx | 24 | ||||
-rw-r--r-- | ucb/source/sorter/sortresult.cxx | 12 | ||||
-rw-r--r-- | ucb/source/sorter/sortresult.hxx | 6 |
3 files changed, 21 insertions, 21 deletions
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 ]; } }; |