diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-10 13:57:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-11 16:01:28 +0200 |
commit | 673347af7d37f6789855c17732c9980d91ec6240 (patch) | |
tree | 4447a73900c50db2f949755eca64a91ac2d9a385 /svtools/source/uno/unoevent.cxx | |
parent | 0bc97adb82f14d6ec22f868422cbfe000afec402 (diff) |
loplugin:useuniqueptr in scaddins..svx
Change-Id: I309f98f6b820103a926e9fe94d67d0aff6eb6476
Reviewed-on: https://gerrit.libreoffice.org/39754
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source/uno/unoevent.cxx')
-rw-r--r-- | svtools/source/uno/unoevent.cxx | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 6a6688574501..04e335a146a1 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -390,26 +390,11 @@ SvDetachedEventDescriptor::SvDetachedEventDescriptor( SvBaseEventDescriptor(pSupportedMacroItems), sImplName("SvDetachedEventDescriptor") { - // allocate aMacros - aMacros = new SvxMacro*[mnMacroItems]; - - // ... and initialize - for(sal_Int16 i = 0; i < mnMacroItems; i++) - { - aMacros[i] = nullptr; - } + aMacros.resize(mnMacroItems); } SvDetachedEventDescriptor::~SvDetachedEventDescriptor() { - // delete contents of aMacros - for(sal_Int16 i = 0; i < mnMacroItems; i++) - { - if (nullptr != aMacros[i]) - delete aMacros[i]; - } - - delete [] aMacros; } sal_Int16 SvDetachedEventDescriptor::getIndex(const sal_uInt16 nID) const @@ -438,8 +423,8 @@ void SvDetachedEventDescriptor::replaceByName( if (-1 == nIndex) throw IllegalArgumentException(); - aMacros[nIndex] = new SvxMacro(rMacro.GetMacName(), rMacro.GetLibName(), - rMacro.GetScriptType() ); + aMacros[nIndex].reset( new SvxMacro(rMacro.GetMacName(), rMacro.GetLibName(), + rMacro.GetScriptType() ) ); } |