basic/source/basmgr/basmgr.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
New commits: commit fafb309d2ec6b7a7125409dabffd13613ad65a0d Author: Muhammet Kara <muhammet.k...@pardus.org.tr> Date: Mon Jun 20 13:56:03 2016 +0300 prefer OUStringBuffer to concatenating OUString in a loop And improve OUString readability and efficiency. See: https://goo.gl/jsVAwy: Change-Id: I8d847b1ca3cde7cb8733d6f8a649612745cf6aae Reviewed-on: https://gerrit.libreoffice.org/26511 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 9b8cf68..918d61d 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -1626,29 +1626,32 @@ ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, OUStri sArgs.remove( 0, 1 ); sArgs.remove( sArgs.getLength() - 1, 1 ); - sQuotedArgs = "("; + OUStringBuffer aBuff; OUString sArgs2 = sArgs.makeStringAndClear(); sal_Int32 nCount = comphelper::string::getTokenCount(sArgs2, ','); + + aBuff.append("("); for (sal_Int32 n = 0; n < nCount; ++n) { - sQuotedArgs += "\""; - sQuotedArgs += sArgs2.getToken(n, ','); - sQuotedArgs += "\""; + aBuff.append( "\"" ); + aBuff.append( sArgs2.getToken(n, ',') ); + aBuff.append( "\"" ); + if ( n < nCount - 1 ) { - sQuotedArgs += ","; + aBuff.append( "," ); } } + aBuff.append( ")" ); - sQuotedArgs += ")"; + sQuotedArgs = aBuff.makeStringAndClear(); } // add quoted arguments and do the call - OUString sCall; - sCall += "["; - sCall += pMethod->GetName(); - sCall += sQuotedArgs; - sCall += "]"; + OUString sCall = "[" + + pMethod->GetName() + + sQuotedArgs + + "]"; SbxVariable* pRet = pMethod->GetParent()->Execute( sCall ); if ( pRet && ( pRet != pMethod ) ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits