From 340d58f2231bdbd16fa5cf14d7085a7d8b0ade09 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 7 Apr 2017 15:01:28 +0200 Subject: use unique_ptr in RegexpMapImpl Change-Id: I150bd441281305346bf6be1844894ae857dd50f7 Reviewed-on: https://gerrit.libreoffice.org/36264 Tested-by: Jenkins Reviewed-by: Noel Grandin --- ucb/source/inc/regexpmap.hxx | 15 ++++----------- 1 file 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 +#include #include #include @@ -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> 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()]. -- cgit