sw/source/core/access/accportions.cxx | 13 ++++++------- sw/source/core/access/accportions.hxx | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-)
New commits: commit 4e8d365c62f31d2a5a6d9778a1ace2be902abb2c Author: Noel Grandin <[email protected]> AuthorDate: Thu Apr 24 13:23:43 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Apr 24 16:07:58 2025 +0200 reduce allocation in SwAccessiblePortionData no need to allocate sentences separately Change-Id: I0743bd7206fa4c7bec887841c8e8a9cbcea1060f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184552 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index 1cc1b73d6a6a..ddeb8d89b4f4 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -447,12 +447,11 @@ void SwAccessiblePortionData::GetSentenceBoundary( OSL_ENSURE( nPos >= 0, "illegal position; check before" ); OSL_ENSURE( nPos < m_sAccessibleString.getLength(), "illegal position" ); - if( m_pSentences == nullptr ) + if( m_aSentences.empty() ) { assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is()); - m_pSentences.reset(new AccessiblePositions); - m_pSentences->reserve(10); + m_aSentences.reserve(10); // use xBreak->endOfSentence to iterate over all words; store // positions in pSentences @@ -460,7 +459,7 @@ void SwAccessiblePortionData::GetSentenceBoundary( sal_Int32 nLength = m_sAccessibleString.getLength(); do { - m_pSentences->push_back( nCurrent ); + m_aSentences.push_back( nCurrent ); const TextFrameIndex nFramePos = GetCoreViewPosition(nCurrent); @@ -478,11 +477,11 @@ void SwAccessiblePortionData::GetSentenceBoundary( while (nCurrent < nLength); // finish with two terminators - m_pSentences->push_back( nLength ); - m_pSentences->push_back( nLength ); + m_aSentences.push_back( nLength ); + m_aSentences.push_back( nLength ); } - FillBoundary( rBound, *m_pSentences, FindBreak( *m_pSentences, nPos ) ); + FillBoundary( rBound, m_aSentences, FindBreak( m_aSentences, nPos ) ); } void SwAccessiblePortionData::GetAttributeBoundary( diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx index 01725c0007de..482355241374 100644 --- a/sw/source/core/access/accportions.hxx +++ b/sw/source/core/access/accportions.hxx @@ -66,7 +66,7 @@ class SwAccessiblePortionData : public SwPortionHandler std::vector<sal_uInt8> m_aPortionAttrs; /// additional portion attributes - std::unique_ptr<AccessiblePositions> m_pSentences; /// positions of sentence breaks + AccessiblePositions m_aSentences; /// positions of sentence breaks size_t m_nBeforePortions; /// # of portions before first core character bool m_bFinished;
