diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-02 15:17:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-04 08:56:56 +0200 |
commit | 869683945a801e86590c165bc6f08832adb7ebb1 (patch) | |
tree | 030ef94da554a2a4a3a3ab8557727afe5e2ecced /connectivity/source/commontools | |
parent | loplugin:useuniqueptr in SfxManageStyleSheetPage (diff) | |
download | core-869683945a801e86590c165bc6f08832adb7ebb1.tar.gz core-869683945a801e86590c165bc6f08832adb7ebb1.zip |
loplugin:useuniqueptr in connectivity::OSortIndex
Change-Id: Ie403862020e8fd1eba96d753e33e9fe5b556f949
Reviewed-on: https://gerrit.libreoffice.org/53764
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source/commontools')
-rw-r--r-- | connectivity/source/commontools/TSortIndex.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/connectivity/source/commontools/TSortIndex.cxx b/connectivity/source/commontools/TSortIndex.cxx index 63e5037a7279..0f06aa11e625 100644 --- a/connectivity/source/commontools/TSortIndex.cxx +++ b/connectivity/source/commontools/TSortIndex.cxx @@ -103,16 +103,15 @@ OSortIndex::~OSortIndex() { } -void OSortIndex::AddKeyValue(OKeyValue * pKeyValue) +void OSortIndex::AddKeyValue(std::unique_ptr<OKeyValue> pKeyValue) { assert(pKeyValue && "Can not be null here!"); if(m_bFrozen) { - m_aKeyValues.push_back(TIntValuePairVector::value_type(pKeyValue->getValue(),nullptr)); - delete pKeyValue; + m_aKeyValues.push_back({pKeyValue->getValue(),nullptr}); } else - m_aKeyValues.push_back(TIntValuePairVector::value_type(pKeyValue->getValue(),pKeyValue)); + m_aKeyValues.push_back({pKeyValue->getValue(),std::move(pKeyValue)}); } void OSortIndex::Freeze() @@ -125,8 +124,7 @@ void OSortIndex::Freeze() for (auto & keyValue : m_aKeyValues) { - delete keyValue.second; - keyValue.second = nullptr; + keyValue.second.reset(); } m_bFrozen = true; @@ -142,9 +140,9 @@ OKeyValue::~OKeyValue() { } -OKeyValue* OKeyValue::createKeyValue(sal_Int32 _nVal) +std::unique_ptr<OKeyValue> OKeyValue::createKeyValue(sal_Int32 _nVal) { - return new OKeyValue(_nVal); + return std::unique_ptr<OKeyValue>(new OKeyValue(_nVal)); } |