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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Mar 5 21:36:47 UTC 2019


 l10ntools/source/lngmerge.cxx |   28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

New commits:
commit 070ea7faa821a01b6a077e24724e37962173cb23
Author:     Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Thu Feb 21 18:25:02 2019 +0100
Commit:     Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Tue Mar 5 22:36:20 2019 +0100

    Use optimized OString concatenation
    
    Change-Id: Iaefacf4a57398d0e88b4de7552af11832db3e881
    Reviewed-on: https://gerrit.libreoffice.org/68178
    Tested-by: Jenkins
    Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>

diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 39f98747e99c..f6939458c588 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -209,9 +209,7 @@ void LngParser::Merge(
                 {
                     sLang = sLang.trim();
 
-                    OString sSearch( ";" );
-                    sSearch += sLang;
-                    sSearch += ";";
+                    OString sSearch{ ";" + sLang + ";" };
 
                     if ( sLanguagesDone.indexOf( sSearch ) != -1 ) {
                         mvLines.erase( mvLines.begin() + nPos );
@@ -226,14 +224,11 @@ void LngParser::Merge(
                                 continue;
 
                             if ( !sNewText.isEmpty()) {
-                                OString & rLine = mvLines[ nPos ];
-
-                                OString sText1( sLang );
-                                sText1 += " = \"";
-                                // escape quotes, unescape double escaped quotes fdo#56648
-                                sText1 += sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"");
-                                sText1 += "\"";
-                                rLine = sText1;
+                                mvLines[ nPos ] = sLang
+                                    + " = \""
+                                    // escape quotes, unescape double escaped quotes fdo#56648
+                                    + sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"")
+                                    + "\"";
                                 Text[ sLang ] = sNewText;
                             }
                         }
@@ -264,12 +259,11 @@ void LngParser::Merge(
                         continue;
                     if ( !sNewText.isEmpty() && sCur != "x-comment")
                     {
-                        OString sLine;
-                        sLine += sCur;
-                        sLine += " = \"";
-                        // escape quotes, unescape double escaped quotes fdo#56648
-                        sLine += sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"");
-                        sLine += "\"";
+                        const OString sLine { sCur
+                            + " = \""
+                            // escape quotes, unescape double escaped quotes fdo#56648
+                            + sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"")
+                            + "\"" };
 
                         nLastLangPos++;
                         nPos++;


More information about the Libreoffice-commits mailing list