[Libreoffice-commits] core.git: basic/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 3 07:08:31 UTC 2018


 basic/source/comp/dim.cxx    |    4 ++--
 basic/source/comp/symtbl.cxx |    3 +--
 basic/source/inc/symtbl.hxx  |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 02caaef29d60370e703bdcdfda09e10e5055d788
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 2 12:48:18 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 3 09:08:04 2018 +0200

    loplugin:useuniqueptr in SbiProcDef
    
    Change-Id: I31c43f8fe40d90094d550b02c5d6213e59149bad
    Reviewed-on: https://gerrit.libreoffice.org/58486
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index a8e08cf6157d..5a3c27dd0577 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -1032,7 +1032,7 @@ void SbiParser::DefDeclare( bool bPrivate )
                 }
                 else
                 {
-                    pDef->Match( p );
+                    pDef->Match( std::unique_ptr<SbiProcDef>(p) );
                 }
             }
             else
@@ -1214,7 +1214,7 @@ void SbiParser::DefProc( bool bStatic, bool bPrivate )
             }
         }
 
-        pDef->Match( pProc );
+        pDef->Match( std::unique_ptr<SbiProcDef>(pProc) );
         pProc = pDef;
     }
     else
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index bef0fdb577d9..5963153e23d0 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -409,7 +409,7 @@ void SbiProcDef::SetType( SbxDataType t )
 // if the match is OK, pOld is replaced by this in the pool
 // pOld is deleted in any case!
 
-void SbiProcDef::Match( SbiProcDef* pOld )
+void SbiProcDef::Match( std::unique_ptr<SbiProcDef> pOld )
 {
     SbiSymDef *pn=nullptr;
     // parameter 0 is the function name
@@ -443,7 +443,6 @@ void SbiProcDef::Match( SbiProcDef* pOld )
         std::swap(pIn->m_Data[nPos], tmp);
         tmp.release();
     }
-    delete pOld;
 }
 
 void SbiProcDef::setPropertyMode( PropertyMode ePropMode )
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index 64a11ea814f3..3c0f9bf0128e 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -194,7 +194,7 @@ public:
 
     // Match with a forward-declaration. The parameter names are
     // compared and the forward declaration is replaced by this
-    void Match( SbiProcDef* pForward );
+    void Match( std::unique_ptr<SbiProcDef> pForward );
 
 private:
     SbiProcDef( const SbiProcDef& ) = delete;


More information about the Libreoffice-commits mailing list