[Libreoffice-commits] core.git: sc/source

Michael Meeks michael.meeks at collabora.com
Mon May 26 06:32:23 PDT 2014


 sc/source/core/tool/compiler.cxx |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit ef334d5acafd918437fbc5d0555a5e161059feb1
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon May 26 13:31:12 2014 +0100

    ODS load/save perf: re-use buffer while exporting tab names.
    
    Allocating temporary strings just to append a '.' is a tad silly.
    
    Change-Id: Ifdbd45bcc4d5e36ebee2b052f64ceeed5686d6cf

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 0af9ad3..304767a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -731,15 +731,13 @@ struct ConventionOOO_A1 : public Convention_A1
     ConventionOOO_A1() : Convention_A1 (FormulaGrammar::CONV_OOO) { }
     ConventionOOO_A1( FormulaGrammar::AddressConvention eConv ) : Convention_A1 (eConv) { }
 
-    static OUString MakeTabStr( const std::vector<OUString>& rTabNames, SCTAB nTab )
+    static void MakeTabStr( OUStringBuffer &rBuf, const std::vector<OUString>& rTabNames, SCTAB nTab )
     {
-        OUString aString;
         if (static_cast<size_t>(nTab) >= rTabNames.size())
-            aString = ScGlobal::GetRscString(STR_NO_REF_TABLE);
+            rBuf.append(ScGlobal::GetRscString(STR_NO_REF_TABLE));
         else
-            aString = rTabNames[nTab];
-        aString += ".";
-        return aString;
+            rBuf.append(rTabNames[nTab]);
+        rBuf.append('.');
     }
 
     void MakeOneRefStrImpl(
@@ -759,10 +757,9 @@ struct ConventionOOO_A1 : public Convention_A1
             }
             else
             {
-                OUString aRefStr(MakeTabStr(rTabNames, rAbsRef.Tab()));
                 if (!rRef.IsTabRel())
                     rBuffer.append('$');
-                rBuffer.append(aRefStr);
+                MakeTabStr(rBuffer, rTabNames, rAbsRef.Tab());
             }
         }
         else if (bODF)


More information about the Libreoffice-commits mailing list