diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-15 16:33:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-19 08:58:46 +0200 |
commit | 61bfcf16dc6e4cedcd82b51a646b89909f035f2d (patch) | |
tree | e77b6e53312197d841873e0ea9d3bd6562aa63e2 /idl | |
parent | 13e55cedd2944c41f3f4fe7032cfea1ef9e6015d (diff) |
loplugin:useuniqueptr in idl
Change-Id: I3681d119dda85400dbb33c96fab736c262f7ce8a
Diffstat (limited to 'idl')
-rw-r--r-- | idl/inc/database.hxx | 2 | ||||
-rw-r--r-- | idl/inc/globals.hxx | 7 | ||||
-rw-r--r-- | idl/source/prj/command.cxx | 4 | ||||
-rw-r--r-- | idl/source/prj/database.cxx | 4 | ||||
-rw-r--r-- | idl/source/prj/globals.cxx | 2 |
5 files changed, 8 insertions, 11 deletions
diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx index bc4ef2a5e27e..65ef714d939b 100644 --- a/idl/inc/database.hxx +++ b/idl/inc/database.hxx @@ -71,7 +71,7 @@ class SvIdlDataBase sal_uInt32 nUniqueId; sal_uInt32 nVerbosity; StringList aIdFileList; - SvStringHashTable * pIdTable; + std::unique_ptr<SvStringHashTable> pIdTable; SvRefMemberList<SvMetaType *> aTypeList; SvRefMemberList<SvMetaClass *> aClassList; diff --git a/idl/inc/globals.hxx b/idl/inc/globals.hxx index 0e118a16a1e3..033a8f270350 100644 --- a/idl/inc/globals.hxx +++ b/idl/inc/globals.hxx @@ -21,6 +21,7 @@ #define INCLUDED_IDL_INC_GLOBALS_HXX #include "hash.hxx" +#include <memory> struct SvGlobalHashNames { @@ -68,8 +69,8 @@ struct SvGlobalHashNames class IdlDll { public: - SvStringHashTable * pHashTable; - SvGlobalHashNames * pGlobalNames; + std::unique_ptr<SvStringHashTable> pHashTable; + std::unique_ptr<SvGlobalHashNames> pGlobalNames; IdlDll(); ~IdlDll(); @@ -81,7 +82,7 @@ IdlDll & GetIdlApp(); inline SvStringHashEntry * SvHash_##Name() \ { \ if( !GetIdlApp().pGlobalNames ) \ - GetIdlApp().pGlobalNames = new SvGlobalHashNames(); \ + GetIdlApp().pGlobalNames.reset( new SvGlobalHashNames() ); \ return GetIdlApp().pGlobalNames->MM_##Name; \ } diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx index 50d410819c28..740d384add60 100644 --- a/idl/source/prj/command.cxx +++ b/idl/source/prj/command.cxx @@ -108,9 +108,9 @@ char const CommandLineSyntax[] = void Init() { if( !GetIdlApp().pHashTable ) - GetIdlApp().pHashTable = new SvStringHashTable; + GetIdlApp().pHashTable.reset( new SvStringHashTable ); if( !GetIdlApp().pGlobalNames ) - GetIdlApp().pGlobalNames = new SvGlobalHashNames(); + GetIdlApp().pGlobalNames.reset( new SvGlobalHashNames() ); } bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand ) diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 62340e70cb0b..62e209fb3f5f 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -54,8 +54,6 @@ SvIdlDataBase::SvIdlDataBase( const SvCommand& rCmd ) SvIdlDataBase::~SvIdlDataBase() { aIdFileList.clear(); - - delete pIdTable; } #define ADD_TYPE( Name ) \ @@ -126,7 +124,7 @@ bool SvIdlDataBase::FindId( const OString& rIdName, sal_uLong * pVal ) void SvIdlDataBase::InsertId( const OString& rIdName, sal_uLong nVal ) { if( !pIdTable ) - pIdTable = new SvStringHashTable; + pIdTable.reset( new SvStringHashTable ); sal_uInt32 nHash; pIdTable->Insert( rIdName, &nHash )->SetValue( nVal ); diff --git a/idl/source/prj/globals.cxx b/idl/source/prj/globals.cxx index 965369b1f130..f57445b56828 100644 --- a/idl/source/prj/globals.cxx +++ b/idl/source/prj/globals.cxx @@ -41,8 +41,6 @@ IdlDll::IdlDll() IdlDll::~IdlDll() { - delete pGlobalNames; - delete pHashTable; } inline SvStringHashEntry * INS( const OString& rName ) |