summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2019-10-17 20:33:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-23 08:55:00 +0200
commitc68be56c295c8dda3043c80d4641575ec2799e55 (patch)
tree40fc9a82e021498f7cebe76e59bec5bb85d6385c /idlc
parent437dc68285dab0f08a1ded2193d86d64f560cd9b (diff)
size some stringbuffer to prevent re-alloc
Change-Id: I385587a922c555c320a45dcc6d644315b72510e9 Reviewed-on: https://gerrit.libreoffice.org/81278 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'idlc')
-rw-r--r--idlc/source/aststructinstance.cxx3
-rw-r--r--idlc/source/idlccompile.cxx12
-rw-r--r--idlc/source/idlcproduce.cxx2
3 files changed, 7 insertions, 10 deletions
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;