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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Jan 27 15:04:06 UTC 2019


 unodevtools/source/skeletonmaker/skeletonmaker.cxx |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 7fa1e75eb49bf46a745caab2265811d3e591802f
Author:     Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Sat Jan 26 00:47:53 2019 +0100
Commit:     Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Sun Jan 27 16:03:44 2019 +0100

    Take advantage of known index to avoid an OUString copy
    
    Change-Id: I3cf7a10f5d27ddc626adea07697aa65e01f6f978
    Reviewed-on: https://gerrit.libreoffice.org/66942
    Tested-by: Jenkins
    Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>

diff --git a/unodevtools/source/skeletonmaker/skeletonmaker.cxx b/unodevtools/source/skeletonmaker/skeletonmaker.cxx
index 14b857ddcee1..aafcde3afd86 100644
--- a/unodevtools/source/skeletonmaker/skeletonmaker.cxx
+++ b/unodevtools/source/skeletonmaker/skeletonmaker.cxx
@@ -232,17 +232,11 @@ SAL_IMPLEMENT_MAIN()
         }
         if ( readOption( &sOption, "p", &nPos, arg) ) {
             OString sTmp(OUStringToOString(sOption, RTL_TEXTENCODING_UTF8));
-            sal_Int32 nIndex= sTmp.indexOf(':');
-            OString sPrt = sTmp.copy(0, nIndex+1);
-            OString sCmds = sTmp.copy(nIndex+1);
-
-            nIndex = 0;
+            sal_Int32 nIndex{ sTmp.indexOf(':')+1 };
+            const OString sPrt = sTmp.copy(0, nIndex);
             std::vector< OString > vCmds;
-            do {
-                OString sCmd = sCmds.getToken( 0, ',', nIndex );
-                vCmds.push_back(sCmd);
-            } while ( nIndex >= 0 );
-
+            while (nIndex>=0)
+                vCmds.push_back(sTmp.getToken( 0, ',', nIndex ));
             options.protocolCmdMap.emplace(sPrt, vCmds);
             continue;
         }


More information about the Libreoffice-commits mailing list