diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-30 08:57:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-02 08:25:46 +0200 |
commit | d90d9b422789b152416cc66f700a9af2d0a8285d (patch) | |
tree | e70ff3b3a69002b1b1b9aa583adeda008fde741a /sfx2/source/config | |
parent | 1cb646dc5fe56c614d2740cdc60d382f3d660b6b (diff) |
loplugin:useuniqueptr in SfxEventNamesList
Change-Id: Ie296881069393001842f4424f398b0edefd89ac5
Reviewed-on: https://gerrit.libreoffice.org/53702
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/config')
-rw-r--r-- | sfx2/source/config/evntconf.cxx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 6bf38484b62d..e612c6156fef 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -50,21 +50,18 @@ using namespace com::sun::star; SfxEventNamesList& SfxEventNamesList::operator=( const SfxEventNamesList& rTbl ) { - DelDtor(); + aEventNamesList.clear(); for ( size_t i = 0, n = rTbl.size(); i < n; ++i ) { SfxEventName* pTmp = rTbl.at( i ); - SfxEventName* pNew = new SfxEventName( *pTmp ); - aEventNamesList.push_back( pNew ); + std::unique_ptr<SfxEventName> pNew(new SfxEventName( *pTmp )); + aEventNamesList.push_back( std::move(pNew) ); } return *this; } -void SfxEventNamesList::DelDtor() +SfxEventNamesList::~SfxEventNamesList() { - for (SfxEventName* i : aEventNamesList) - delete i; - aEventNamesList.clear(); } bool SfxEventNamesItem::operator==( const SfxPoolItem& rAttr ) const @@ -114,7 +111,7 @@ sal_uInt16 SfxEventNamesItem::GetVersion( sal_uInt16 ) const void SfxEventNamesItem::AddEvent( const OUString& rName, const OUString& rUIName, SvMacroItemId nID ) { - aEventsList.push_back( new SfxEventName( nID, rName, !rUIName.isEmpty() ? rUIName : rName ) ); + aEventsList.push_back( std::unique_ptr<SfxEventName>(new SfxEventName( nID, rName, !rUIName.isEmpty() ? rUIName : rName )) ); } |