From 789055bc2acb4c71483fd60ea258d158bd5aec10 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Apr 2016 16:39:03 +0200 Subject: clang-tidy performance-unnecessary-copy-initialization probably not much performance benefit, but it sure is good at identifying leftover intermediate variables from previous refactorings. Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657 Reviewed-on: https://gerrit.libreoffice.org/24026 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- stoc/source/implementationregistration/implreg.cxx | 15 +++++---------- stoc/source/typeconv/convert.cxx | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'stoc') diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 438ee792e1e9..a5c663d2ff93 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -467,8 +467,7 @@ void deletePathIfPossible(const Reference < XRegistryKey >& xRootKey, { xRootKey->deleteKey(path); - OUString tmpPath(path); - OUString newPath = tmpPath.copy(0, tmpPath.lastIndexOf('/')); + OUString newPath = path.copy(0, path.lastIndexOf('/')); if (newPath.getLength() > 1) deletePathIfPossible(xRootKey, newPath); @@ -576,8 +575,7 @@ void deleteUserLink(const Reference < XRegistryKey >& xRootKey, if (bClean) { - OUString tmpName(linkName); - OUString path = tmpName.copy(0, tmpName.lastIndexOf('/')); + OUString path = linkName.copy(0, linkName.lastIndexOf('/')); deletePathIfPossible(xRootKey, path); } } @@ -1437,14 +1435,12 @@ void ImplementationRegistration::prepareRegister( const Reference < XSimpleRegistry > & xReg) // throw( CannotRegisterImplementationException, RuntimeException ) { - OUString implLoaderUrl(implementationLoaderUrl); OUString activatorName; if (!implementationLoaderUrl.isEmpty()) { - OUString tmpActivator(implementationLoaderUrl); sal_Int32 nIndex = 0; - activatorName = tmpActivator.getToken(0, ':', nIndex ); + activatorName = implementationLoaderUrl.getToken(0, ':', nIndex ); } else { // check locationUrl to find out what kind of loader is needed @@ -1472,7 +1468,7 @@ void ImplementationRegistration::prepareRegister( if ( xRegistry.is()) { - doRegister(m_xSMgr, m_xCtx, xAct, xRegistry, implLoaderUrl, + doRegister(m_xSMgr, m_xCtx, xAct, xRegistry, implementationLoaderUrl, locationUrl, registeredLocationUrl); } } @@ -1591,9 +1587,8 @@ Sequence< OUString > ImplementationRegistration::getImplementations( if (!implementationLoaderUrl.isEmpty()) { - OUString tmpActivator(implementationLoaderUrl); sal_Int32 nIndex = 0; - activatorName = tmpActivator.getToken(0, ':', nIndex ); + activatorName = implementationLoaderUrl.getToken(0, ':', nIndex ); } else { // check locationUrl to find out what kind of loader is needed diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx index c595c17a4588..b0bfb0c4fc6a 100644 --- a/stoc/source/typeconv/convert.cxx +++ b/stoc/source/typeconv/convert.cxx @@ -486,7 +486,7 @@ double TypeConverter_Impl::toDouble( const Any& rAny, double min, double max ) Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestType ) throw( IllegalArgumentException, CannotConvertException, RuntimeException, std::exception) { - Type aSourceType = rVal.getValueType(); + const Type& aSourceType = rVal.getValueType(); if (aSourceType == aDestType) return rVal; @@ -705,7 +705,7 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina Reference< XInterface >(), (sal_Int16) 1 ); } - Type aSourceType = rVal.getValueType(); + const Type& aSourceType = rVal.getValueType(); TypeClass aSourceClass = aSourceType.getTypeClass(); if (aDestinationClass == aSourceClass) return rVal; -- cgit