summaryrefslogtreecommitdiff
path: root/codemaker
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-21 08:36:01 +0200
commit0f874472c672175135520101837ff0c9d4701d7f (patch)
treefa6a504bdfc7d5d838caed7cfb87793321797290 /codemaker
parent9112c18524c9f5e67d6cbb282586a439e3020cdb (diff)
size some stringbuffer to prevent re-alloc
found by the simple expidient of putting asserts in the resize routine. Where an explicit const size is used, I started with 32 and kept doubling until that site did not need resizing anymore. Change-Id: I998787edc940d0a3ba23b5ac37131ab9ecd300f4 Reviewed-on: https://gerrit.libreoffice.org/81138 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 67b842f0c3d1..a16256d4c353 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -1004,7 +1004,7 @@ OUString CppuType::resolveAllTypedefs(OUString const & name) const
u2b(dynamic_cast<unoidl::TypedefEntity&>(*ent).getType()), &k2));
k1 += k2; //TODO: overflow
}
- OUStringBuffer b;
+ OUStringBuffer b(k1*2 + n.getLength());
for (sal_Int32 i = 0; i != k1; ++i) {
b.append("[]");
}
@@ -2675,7 +2675,7 @@ OUString typeToIdentifier(OUString const & name)
{
sal_Int32 k;
OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k)));
- OUStringBuffer b;
+ OUStringBuffer b(4*k + n.getLength());
for (sal_Int32 i = 0; i != k; ++i) {
b.append("seq_");
}
@@ -3587,7 +3587,7 @@ void ServiceType::dumpHppFile(
for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param :
cons.parameters) {
o << ", ";
- OUStringBuffer buf;
+ OUStringBuffer buf(2 + param.type.getLength());
if (param.rest) {
buf.append("[]");
}