diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-04-25 17:17:23 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-04-29 22:50:46 +0200 |
commit | 209a8d4ab598249baf5304e33a934873cce9f48e (patch) | |
tree | b70fc10da3f4c18a803816344450216f8ccbce8b | |
parent | 4f03fabc4bf02400b961f8f3117ed07bd8ff81f5 (diff) |
Avoid OUString temporaries and bail out early
Change-Id: Ic4c1b2ce68ba992744bd68dece0afc417c22e5cd
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index b2055a979b59..f2550b36fa23 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -1422,21 +1422,18 @@ OUString SAL_CALL SwXDocumentIndex::getName() { SolarMutexGuard g; - OUString uRet; SwSectionFormat *const pSectionFormat( m_pImpl->GetSectionFormat() ); if (m_pImpl->m_bIsDescriptor) { - uRet = m_pImpl->m_pProps->GetTOXBase().GetTOXName(); + return m_pImpl->m_pProps->GetTOXBase().GetTOXName(); } - else if(pSectionFormat) - { - uRet = pSectionFormat->GetSection()->GetSectionName(); - } - else + + if(!pSectionFormat) { throw uno::RuntimeException(); } - return uRet; + + return pSectionFormat->GetSection()->GetSectionName(); } void SAL_CALL @@ -1727,21 +1724,18 @@ SwXDocumentIndexMark::getMarkEntry() { SolarMutexGuard aGuard; - OUString sRet; SwTOXType *const pType = m_pImpl->GetTOXType(); if (pType && m_pImpl->m_pTOXMark) { - sRet = m_pImpl->m_pTOXMark->GetAlternativeText(); - } - else if (m_pImpl->m_bIsDescriptor) - { - sRet = m_pImpl->m_sAltText; + return m_pImpl->m_pTOXMark->GetAlternativeText(); } - else + + if (!m_pImpl->m_bIsDescriptor) { throw uno::RuntimeException(); } - return sRet; + + return m_pImpl->m_sAltText; } void SAL_CALL @@ -1932,7 +1926,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark( // thus use a space - is this really the ideal solution? if (!bMark && rMark.GetAlternativeText().isEmpty()) { - rMark.SetAlternativeText( OUString(' ') ); + rMark.SetAlternativeText( " " ); } const bool bForceExpandHints( !bMark && pTextCursor && pTextCursor->IsAtEndOfMeta() ); |