Kaydet (Commit) 61bfcf16 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in idl

Change-Id: I3681d119dda85400dbb33c96fab736c262f7ce8a
üst 13e55ced
......@@ -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;
......
......@@ -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; \
}
......
......@@ -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 )
......
......@@ -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 );
......
......@@ -41,8 +41,6 @@ IdlDll::IdlDll()
IdlDll::~IdlDll()
{
delete pGlobalNames;
delete pHashTable;
}
inline SvStringHashEntry * INS( const OString& rName )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment