diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-07 15:01:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-10 08:53:48 +0200 |
commit | 340d58f2231bdbd16fa5cf14d7085a7d8b0ade09 (patch) | |
tree | 1ff9fa62653220bc1581a2f8c174376494c53a9e | |
parent | 2841cf6c9f733c2c26e90b8494b5b076cc9d507d (diff) |
use unique_ptr in RegexpMapImpl
Change-Id: I150bd441281305346bf6be1844894ae857dd50f7
Reviewed-on: https://gerrit.libreoffice.org/36264
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | ucb/source/inc/regexpmap.hxx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/ucb/source/inc/regexpmap.hxx b/ucb/source/inc/regexpmap.hxx index e9475f8a9684..d1658e7f0f95 100644 --- a/ucb/source/inc/regexpmap.hxx +++ b/ucb/source/inc/regexpmap.hxx @@ -23,6 +23,7 @@ #include "sal/config.h" #include <list> +#include <memory> #include <rtl/ustring.hxx> #include <sal/types.h> @@ -73,11 +74,7 @@ template< typename Val > struct RegexpMapImpl { List< Val > m_aList[Regexp::KIND_DOMAIN + 1]; - Entry< Val > * m_pDefault; - - RegexpMapImpl(): m_pDefault(nullptr) {} - - ~RegexpMapImpl() { delete m_pDefault; } + std::unique_ptr<Entry< Val >> m_pDefault; }; @@ -426,7 +423,7 @@ void RegexpMap< Val >::add(rtl::OUString const & rKey, Val const & rValue) { return; } - m_pImpl->m_pDefault = new Entry< Val >(aRegexp, rValue); + m_pImpl->m_pDefault.reset( new Entry< Val >(aRegexp, rValue) ); } else { @@ -478,11 +475,7 @@ void RegexpMap< Val >::erase(iterator const & rPos) { if (rPos.m_pImpl->getList() == -1) { - if (m_pImpl->m_pDefault) - { - delete m_pImpl->m_pDefault; - m_pImpl->m_pDefault = 0; - } + m_pImpl->m_pDefault.reset(); } else m_pImpl->m_aList[rPos.m_pImpl->getList()]. |