From c68be56c295c8dda3043c80d4641575ec2799e55 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 17 Oct 2019 20:33:50 +0200 Subject: size some stringbuffer to prevent re-alloc Change-Id: I385587a922c555c320a45dcc6d644315b72510e9 Reviewed-on: https://gerrit.libreoffice.org/81278 Tested-by: Jenkins Reviewed-by: Noel Grandin --- idlc/source/aststructinstance.cxx | 3 ++- idlc/source/idlccompile.cxx | 12 ++++-------- idlc/source/idlcproduce.cxx | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'idlc') diff --git a/idlc/source/aststructinstance.cxx b/idlc/source/aststructinstance.cxx index e7723d19bd2d..878745793fd2 100644 --- a/idlc/source/aststructinstance.cxx +++ b/idlc/source/aststructinstance.cxx @@ -31,7 +31,8 @@ namespace { OString createName( AstType const * typeTemplate, DeclList const * typeArguments) { - OStringBuffer buf(typeTemplate->getScopedName()); + OStringBuffer buf(64); + buf.append(typeTemplate->getScopedName()); if (typeArguments != nullptr) { buf.append('<'); for (DeclList::const_iterator i(typeArguments->begin()); diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 56dbfe4e77ec..8d3897890e0f 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -238,7 +238,6 @@ sal_Int32 compileFile(const OString * pathname) lCppArgs.emplace_back("-C"); lCppArgs.emplace_back("-zI"); - OStringBuffer cppArgs(256); Options* pOptions = idlc()->getOptions(); OString filePath; @@ -250,10 +249,9 @@ sal_Int32 compileFile(const OString * pathname) if ( !filePath.isEmpty() ) { - cppArgs.append("-I"); - cppArgs.append(filePath); + OString cppArgs = "-I" + filePath; lCppArgs.push_back(OStringToOUString( - cppArgs.makeStringAndClear().replace('\\', '/'), + cppArgs.replace('\\', '/'), RTL_TEXTENCODING_UTF8)); } } @@ -284,11 +282,9 @@ sal_Int32 compileFile(const OString * pathname) lCppArgs.emplace_back("-o"); - cppArgs.append(preprocFile); - lCppArgs.push_back(OStringToOUString(cppArgs.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); + lCppArgs.push_back(OStringToOUString(preprocFile, RTL_TEXTENCODING_UTF8)); - cppArgs.append(tmpFile); - lCppArgs.push_back(OStringToOUString(cppArgs.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); + lCppArgs.push_back(OStringToOUString(tmpFile, RTL_TEXTENCODING_UTF8)); OUString cpp; OUString startDir; diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index f87992d6b859..ff9ca2f2d47f 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -44,7 +44,7 @@ static std::list< OString >* pCreatedDirectories = nullptr; static bool checkOutputPath(const OString& completeName) { OString sysPathName = convertToAbsoluteSystemPath(completeName); - OStringBuffer buffer(sysPathName.getLength()); + OStringBuffer buffer(sysPathName.getLength()+16); if ( sysPathName.indexOf( SEPARATOR ) == -1 ) return true; -- cgit