summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-29 12:29:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-29 13:21:18 +0200
commit7e3b3a9bd5370c68877d7d6abe97043460a687ca (patch)
treec6a4823203e3bf62a827d4bf5b249b71a98d3aec
parent3df5be9210ec0a057567f7f68aac445a77facb71 (diff)
tdf#119840 make this loop a little more efficient
by breaking out early Change-Id: I2444c9f8b79e0b517eb3ab3b19fed2d98c52a8e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137615 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/text/txtfld.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index d258127f0701..9aa36c0c86d3 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -553,16 +553,21 @@ static const SwRangeRedline* lcl_GetRedlineAtNodeInsertionOrDeletion( const SwTe
for( ; nRedlPos < rTable.size() ; ++nRedlPos )
{
const SwRangeRedline* pTmp = rTable[ nRedlPos ];
+ SwNodeOffset nStart = pTmp->GetPoint()->nNode.GetIndex(),
+ nEnd = pTmp->GetMark()->nNode.GetIndex();
+ if( nStart > nEnd )
+ std::swap(nStart, nEnd);
if( RedlineType::Delete == pTmp->GetType() ||
RedlineType::Insert == pTmp->GetType() )
{
- auto [pRStt, pREnd ]= pTmp->StartEnd(); // SwPosition*
- if( pRStt->nNode <= nNdIdx && pREnd->nNode > nNdIdx )
+ if( nStart <= nNdIdx && nEnd > nNdIdx )
{
bIsMoved = pTmp->IsMoved();
return pTmp;
}
}
+ if( nStart > nNdIdx )
+ break;
}
}
return nullptr;