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-26 12:38:33 +0200 |
commit | e276c812648bf511d6c4813d6fd82a00391cfdac (patch) | |
tree | adbf24f41bef128a081cc1cc117c8023a3eed65d /basic/source | |
parent | d04f044f05b4d13c3c6ea3f33fddd9c05a0ab3ad (diff) |
size some stringbuffer to prevent re-alloc
I started with 32 and kept doubling the size until the site
did not need re-alloc, but clamped it at 512 (e.g. in emfio/).
Change-Id: Ib7caf35a1b7e42b0e4ed8aa812493449e3eefc8f
Reviewed-on: https://gerrit.libreoffice.org/81540
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/comp/scanner.cxx | 2 | ||||
-rw-r--r-- | basic/source/runtime/methods1.cxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxcurr.cxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxform.cxx | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index f08c0178d38e..eee3764ab995 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -526,7 +526,7 @@ bool SbiScanner::NextSym() else aSym = aLine.copy( n, nCol - n - 1 ); // get out duplicate string delimiters - OUStringBuffer aSymBuf; + OUStringBuffer aSymBuf(aSym.getLength()); for ( sal_Int32 i = 0, len = aSym.getLength(); i < len; ++i ) { aSymBuf.append( aSym[i] ); diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 2af16a5a712e..62016979049d 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -1544,7 +1544,7 @@ void SbRtl_Join(StarBASIC *, SbxArray & rPar, bool) { aDelim = " "; } - OUStringBuffer aRetStr; + OUStringBuffer aRetStr(32); short nLower, nUpper; pArr->GetDim( 1, nLower, nUpper ); short aIdx[1]; diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx index a1d274a0bdfd..b8df44d9fa26 100644 --- a/basic/source/sbx/sbxcurr.cxx +++ b/basic/source/sbx/sbxcurr.cxx @@ -35,7 +35,6 @@ static OUString ImpCurrencyToString( sal_Int64 rVal ) sal_Unicode const cDecimalSep = '.'; OUString aAbsStr = OUString::number( absVal ); - OUStringBuffer aBuf; sal_Int32 initialLen = aAbsStr.getLength(); @@ -53,6 +52,7 @@ static OUString ImpCurrencyToString( sal_Int64 rVal ) if ( isNeg ) ++nCapacity; + OUStringBuffer aBuf( nCapacity ); aBuf.setLength( nCapacity ); diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx index 21ffa197a70e..c291f3e23af3 100644 --- a/basic/source/sbx/sbxform.cxx +++ b/basic/source/sbx/sbxform.cxx @@ -519,7 +519,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber, nMultipleThousandSeparators; bool bPercent,bCurrency,bScientific,bGenerateThousandSeparator; - OUStringBuffer sReturnStrg; + OUStringBuffer sReturnStrg(32); // analyse the format-string, i. e. determine the following values: /* |