diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-10-17 20:33:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-21 08:36:01 +0200 |
commit | 0f874472c672175135520101837ff0c9d4701d7f (patch) | |
tree | fa6a504bdfc7d5d838caed7cfb87793321797290 /idl | |
parent | 9112c18524c9f5e67d6cbb282586a439e3020cdb (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 'idl')
-rw-r--r-- | idl/source/cmptools/lex.cxx | 4 | ||||
-rw-r--r-- | idl/source/objects/object.cxx | 3 | ||||
-rw-r--r-- | idl/source/objects/types.cxx | 2 | ||||
-rw-r--r-- | idl/source/prj/database.cxx | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx index 599b06136008..f479bea4c4b7 100644 --- a/idl/source/cmptools/lex.cxx +++ b/idl/source/cmptools/lex.cxx @@ -254,7 +254,7 @@ bool SvTokenStream::MakeToken( SvToken & rToken ) } else if( c == '"' ) { - OStringBuffer aStr; + OStringBuffer aStr(128); bool bDone = false; while( !bDone && !IsEof() && c ) { @@ -288,7 +288,7 @@ bool SvTokenStream::MakeToken( SvToken & rToken ) } else if( rtl::isAsciiAlpha (static_cast<unsigned char>(c)) || (c == '_') ) { - OStringBuffer aBuf; + OStringBuffer aBuf(64); while( rtl::isAsciiAlphanumeric( static_cast<unsigned char>(c) ) || c == '_' || c == ':') { diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index 4becd0240289..a424bb748044 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -209,7 +209,8 @@ void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>& { SvClassElement& rElement = aClassElementList[n]; SvMetaClass * pCl = rElement.GetClass(); - OStringBuffer rPre(rPrefix); + OStringBuffer rPre(rPrefix.getLength() + 1 + rElement.GetPrefix().getLength()); + rPre.append(rPrefix); if( !rPre.isEmpty() && !rElement.GetPrefix().isEmpty() ) rPre.append('.'); rPre.append(rElement.GetPrefix()); diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index d79efe81fc43..34b0e3b78847 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -223,7 +223,7 @@ void SvMetaType::WriteSfxItem( WriteStars( rOutStm ); OString aVarName = " a" + rItemName + "_Impl"; - OStringBuffer aAttrArray; + OStringBuffer aAttrArray(1024); sal_uLong nAttrCount = MakeSfx( aAttrArray ); OString aAttrCount( OString::number(nAttrCount)); OString aTypeName = "SfxType" + aAttrCount; diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index f76b38687915..b63205a0911b 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -221,7 +221,7 @@ bool SvIdlDataBase::ReadIdFile( const OString& rOFileName ) else if( rTok.Is( SvHash_include() ) ) { rTok = aTokStm.GetToken_Next(); - OStringBuffer aNameBuf; + OStringBuffer aNameBuf(128); if( rTok.IsString() ) aNameBuf.append(rTok.GetString()); else if( rTok.IsChar() && rTok.GetChar() == '<' ) |