basic/source/comp/dim.cxx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
New commits: commit 298feac9c4d4204bdb6680f3bdd4ab97b2a6dad8 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Oct 31 09:25:04 2024 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Oct 31 12:14:18 2024 +0100 No need to heap-allocate it Change-Id: Ia6bbf6d3f5b9af2a5b52b8c6baec85bdcb579275 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175847 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 7321d8496a6e..1e1d44306918 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -987,20 +987,21 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl ) bool bError2 = true; if( bOptional && bCompatible && eTok == EQ ) { - auto pDefaultExpr = std::make_unique<SbiConstExpression>(this); - SbxDataType eType2 = pDefaultExpr->GetType(); - - sal_uInt16 nStringId; - if( eType2 == SbxSTRING ) { - nStringId = aGblStrings.Add( pDefaultExpr->GetString() ); - } - else - { - nStringId = aGblStrings.Add( pDefaultExpr->GetValue(), eType2 ); + SbiConstExpression aDefaultExpr(this); + SbxDataType eType2 = aDefaultExpr.GetType(); + + sal_uInt16 nStringId; + if (eType2 == SbxSTRING) + { + nStringId = aGblStrings.Add(aDefaultExpr.GetString()); + } + else + { + nStringId = aGblStrings.Add(aDefaultExpr.GetValue(), eType2); + } + pPar->SetDefaultId(nStringId); } - pPar->SetDefaultId( nStringId ); - pDefaultExpr.reset(); eTok = Next(); if( eTok == COMMA || eTok == RPAREN )
