diff options
author | Arnaud Versini <arnaud.versini@libreoffice.org> | 2020-11-05 18:14:34 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-05 20:39:26 +0100 |
commit | 8ad514c6653c063f487ad40b4dbcd57a86e78e41 (patch) | |
tree | f7b363607b91ec14a3508dcf8c2601c7d47a644f /basic/source | |
parent | ac6df04b5c5a7c227fec3b8897c79be5e99cbe01 (diff) |
BASIC : use std::make_unique instead of std::unique_ptr ( new ... )
Change-Id: Ic907f4711685539b6a89411e704845617cc5f04d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105375
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 5 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 2 | ||||
-rw-r--r-- | basic/source/comp/dim.cxx | 2 | ||||
-rw-r--r-- | basic/source/comp/exprtree.cxx | 4 | ||||
-rw-r--r-- | basic/source/comp/io.cxx | 10 | ||||
-rw-r--r-- | basic/source/comp/loops.cxx | 2 | ||||
-rw-r--r-- | basic/source/runtime/ddectrl.cxx | 2 | ||||
-rw-r--r-- | basic/source/uno/namecont.cxx | 4 | ||||
-rw-r--r-- | basic/source/uno/scriptcont.cxx | 2 |
9 files changed, 16 insertions, 17 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index c7bc2e468198..d1d4b86565b7 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -844,9 +844,8 @@ void BasicManager::Init() BasicLibInfo* BasicManager::CreateLibInfo() { - BasicLibInfo* pInf(new BasicLibInfo); - mpImpl->aLibs.push_back(std::unique_ptr<BasicLibInfo>(pInf)); - return pInf; + mpImpl->aLibs.push_back(std::make_unique<BasicLibInfo>()); + return mpImpl->aLibs.back().get(); } bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage ) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index c7b62b70278c..5e9647e955a7 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1714,7 +1714,7 @@ void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache) ErrorHdlResetter aErrHdl; SbxBase::ResetError(); - std::unique_ptr<SbiParser> pParser(new SbiParser( static_cast<StarBASIC*>(GetParent()), this )); + auto pParser = std::make_unique<SbiParser>(static_cast<StarBASIC*>(GetParent()), this ); pParser->SetCodeCompleting(true); while( pParser->Parse() ) {} diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 43352aea3f1f..17eef0a263a5 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -952,7 +952,7 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl ) bool bError2 = true; if( bOptional && bCompatible && eTok == EQ ) { - std::unique_ptr<SbiConstExpression> pDefaultExpr(new SbiConstExpression( this )); + auto pDefaultExpr = std::make_unique<SbiConstExpression>(this); SbxDataType eType2 = pDefaultExpr->GetType(); sal_uInt16 nStringId; diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index bc9f4d5b3b94..38b9adeb9800 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -348,7 +348,7 @@ std::unique_ptr<SbiExprNode> SbiExpression::Term( const KeywordSymbolInfo* pKeyw } } } - std::unique_ptr<SbiExprNode> pNd(new SbiExprNode( *pDef, eType )); + auto pNd = std::make_unique<SbiExprNode>( *pDef, eType ); if( !pPar ) { pPar = SbiExprList::ParseParameters( pParser,false,false ); @@ -454,7 +454,7 @@ std::unique_ptr<SbiExprNode> SbiExpression::ObjTerm( SbiSymDef& rObj ) pDef->SetType( eType ); } - std::unique_ptr<SbiExprNode> pNd(new SbiExprNode( *pDef, eType )); + auto pNd = std::make_unique<SbiExprNode>( *pDef, eType ); pNd->aVar.pPar = pPar.release(); pNd->aVar.pvMorePar = pvMoreParLcl; if( bObj ) diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx index 45581c70e9f2..9e91413fd997 100644 --- a/basic/source/comp/io.cxx +++ b/basic/source/comp/io.cxx @@ -53,7 +53,7 @@ void SbiParser::Print() { if( !IsEoln( Peek() ) ) { - std::unique_ptr<SbiExpression> pExpr(new SbiExpression( this )); + auto pExpr = std::make_unique<SbiExpression>(this); pExpr->Gen(); pExpr.reset(); Peek(); @@ -82,7 +82,7 @@ void SbiParser::Write() while( !bAbort ) { - std::unique_ptr<SbiExpression> pExpr(new SbiExpression( this )); + auto pExpr = std::make_unique<SbiExpression>(this); pExpr->Gen(); pExpr.reset(); aGen.Gen( SbiOpcode::BWRITE_ ); @@ -130,7 +130,7 @@ void SbiParser::Line() void SbiParser::LineInput() { Channel( true ); - std::unique_ptr<SbiExpression> pExpr(new SbiExpression( this, SbOPERAND )); + auto pExpr = std::make_unique<SbiExpression>( this, SbOPERAND ); if( !pExpr->IsVariable() ) Error( ERRCODE_BASIC_VAR_EXPECTED ); if( pExpr->GetType() != SbxVARIANT && pExpr->GetType() != SbxSTRING ) @@ -147,7 +147,7 @@ void SbiParser::Input() { aGen.Gen( SbiOpcode::RESTART_ ); Channel( true ); - std::unique_ptr<SbiExpression> pExpr(new SbiExpression( this, SbOPERAND )); + auto pExpr = std::make_unique<SbiExpression>( this, SbOPERAND ); while( !bAbort ) { if( !pExpr->IsVariable() ) @@ -236,7 +236,7 @@ void SbiParser::Open() } TestToken( AS ); // channel number - std::unique_ptr<SbiExpression> pChan(new SbiExpression( this )); + auto pChan = std::make_unique<SbiExpression>( this ); std::unique_ptr<SbiExpression> pLen; if( Peek() == SYMBOL ) { diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx index 2d174efa2a4a..07aac44943a6 100644 --- a/basic/source/comp/loops.cxx +++ b/basic/source/comp/loops.cxx @@ -67,7 +67,7 @@ void SbiParser::If() aGen.BackChain( nEndLbl ); aGen.Statement(); - std::unique_ptr<SbiExpression> pCond(new SbiExpression( this )); + auto pCond = std::make_unique<SbiExpression>( this ); pCond->Gen(); nEndLbl = aGen.Gen( SbiOpcode::JUMPF_, 0 ); pCond.reset(); diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx index 95be54507a8a..bb2c4c5548f1 100644 --- a/basic/source/runtime/ddectrl.cxx +++ b/basic/source/runtime/ddectrl.cxx @@ -100,7 +100,7 @@ ErrCode SbiDdeControl::Initiate( const OUString& rService, const OUString& rTopi size_t& rnHandle ) { ErrCode nErr; - std::unique_ptr<DdeConnection> pConv(new DdeConnection( rService, rTopic )); + auto pConv = std::make_unique<DdeConnection> ( rService, rTopic ); nErr = GetLastErr( pConv.get() ); if( nErr ) { diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 58401206fc4d..ec112b466f3f 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -795,7 +795,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, source.sSystemId = aFileName; // start parsing - std::unique_ptr< ::xmlscript::LibDescriptorArray> pLibArray(new ::xmlscript::LibDescriptorArray()); + auto pLibArray = std::make_unique<::xmlscript::LibDescriptorArray> ( ); try { @@ -1845,7 +1845,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto int iArray = 0; pName = aNames.getConstArray(); ::xmlscript::LibDescriptor aLibDescriptorForExtensionLibs; - std::unique_ptr< ::xmlscript::LibDescriptorArray > pLibArray(new ::xmlscript::LibDescriptorArray(nLibsToSave)); + auto pLibArray = std::make_unique< ::xmlscript::LibDescriptorArray > ( nLibsToSave ); for( ; pName != pNamesEnd; ++pName ) { SfxLibrary* pImplLib = getImplLib( *pName ); diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 070d3cbbd74b..652a7fbc3129 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -324,7 +324,7 @@ void SfxScriptLibraryContainer::importFromOldStorage( const OUString& aFile ) auto xStorage = tools::make_ref<SotStorage>( false, aFile ); if( xStorage->GetError() == ERRCODE_NONE ) { - std::unique_ptr<BasicManager> pBasicManager(new BasicManager( *xStorage, aFile )); + auto pBasicManager = std::make_unique<BasicManager> ( *xStorage, aFile ); // Set info LibraryContainerInfo aInfo( this, nullptr, static_cast< OldBasicPassword* >( this ) ); |