[Libreoffice-commits] core.git: sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun May 26 13:05:58 UTC 2019


 sw/source/core/doc/docbm.cxx |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 06d39b8663fd98a82cec4015eee3b425f92bc51d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat May 25 13:44:52 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun May 26 15:05:14 2019 +0200

    tdf#125372 writer, file with lots of hints very slow to open, part2
    
    Reduce unnecessary scanning on MarkManager::deleteMark
    
    Change-Id: I4af07877a98b12f20f486974eb77ee2989a2fbc9
    Reviewed-on: https://gerrit.libreoffice.org/72949
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index ac20908aff32..6b28d7a54e7e 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1018,20 +1018,19 @@ namespace sw { namespace mark
             " - Mark is not in my doc.");
         // finds the last Mark that is starting before pMark
         // (pMarkLow < pMark)
-        iterator_t pMarkLow =
-            lower_bound(
+        auto it = lower_bound(
                 m_vAllMarks.begin(),
                 m_vAllMarks.end(),
                 pMark->GetMarkStart(),
                 sw::mark::CompareIMarkStartsBefore());
-        iterator_t pMarkHigh = m_vAllMarks.end();
-        iterator_t pMarkFound =
-            find_if(
-                pMarkLow,
-                pMarkHigh,
-                [pMark] (pMark_t const& rpMark) { return rpMark.get() == pMark; } );
-        if(pMarkFound != pMarkHigh)
-            deleteMark(pMarkFound);
+        for ( ; it != m_vAllMarks.end(); ++it)
+            if (pMark->StartsBefore((*it)->GetMarkStart()))
+                break;
+            else if (it->get() == pMark)
+            {
+                deleteMark(it);
+                break;
+            }
     }
 
     void MarkManager::clearAllMarks()


More information about the Libreoffice-commits mailing list