sc/source/filter/excel/tokstack.cxx |    4 +---
 sc/source/filter/inc/tokstack.hxx   |    4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 9a238644f21014cef085b7124ebc3d1397e85870
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Wed Jul 11 11:20:27 2018 +0200

    loplugin:useuniqueptr in TokenPool
    
    Change-Id: I25ff554e1dae45ff62bb3f036590a57a79d54b28
    Reviewed-on: https://gerrit.libreoffice.org/57296
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/excel/tokstack.cxx 
b/sc/source/filter/excel/tokstack.cxx
index 1296f319bd6a..18fb99aae1e1 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -61,7 +61,7 @@ TokenPool::TokenPool( svl::SharedStringPool& rSPool ) :
     ppP_Matrix.reset( new ScMatrix*[ nP_Matrix ] );
     memset( ppP_Matrix.get(), 0, sizeof( ScMatrix* ) * nP_Matrix );
 
-    pScToken = new ScTokenArray;
+    pScToken.reset(new ScTokenArray);
 
     Reset();
 }
@@ -69,8 +69,6 @@ TokenPool::TokenPool( svl::SharedStringPool& rSPool ) :
 TokenPool::~TokenPool()
 {
     ClearMatrix();
-
-    delete pScToken;
 }
 
 /** Returns the new number of elements, or 0 if overflow. */
diff --git a/sc/source/filter/inc/tokstack.hxx 
b/sc/source/filter/inc/tokstack.hxx
index b985d5f45d9d..397de91536ea 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -211,7 +211,7 @@ private:
 #ifdef DBG_UTIL
         sal_uInt16                      m_nRek; // recursion counter
 #endif
-        ScTokenArray*               pScToken;   // Token array
+        std::unique_ptr<ScTokenArray>   pScToken;   // Token array
 
         bool                        GrowTripel( sal_uInt16 nByMin );
         bool                        GrowId();
@@ -426,7 +426,7 @@ const inline ScTokenArray* TokenPool::operator []( const 
TokenId& rId )
         GetElement( static_cast<sal_uInt16>(rId) - 1 );
     }
 
-    return pScToken;
+    return pScToken.get();
 }
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to