sw/inc/pam.hxx              |   16 ++++------------
 sw/source/core/crsr/pam.cxx |   12 ------------
 2 files changed, 4 insertions(+), 24 deletions(-)

New commits:
commit 059892da740e4272477ad0d69183b0e9b77129d7
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun May 7 17:39:01 2023 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun May 7 21:03:41 2023 +0200

    Simplify a bit
    
    Change-Id: Ibcf59feaa1631c06a393017d1b6342d4a646b9a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151387
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 2a7a0cdb8bd3..62721beb0c4c 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -27,6 +27,7 @@
 #include "nodeoffset.hxx"
 
 #include <iostream>
+#include <utility>
 
 class SwDoc;
 class SwPaM;
@@ -230,7 +231,7 @@ public:
 
     void DeleteMark()
     {
-        if (m_pMark != m_pPoint)
+        if (HasMark())
         {
             /** clear the mark position; this helps if mark's SwContentIndex is
                registered at some node, and that node is then deleted */
@@ -238,20 +239,11 @@ public:
             m_pMark = m_pPoint;
         }
     }
-#ifdef DBG_UTIL
-    void Exchange();
-
-#else
     void Exchange()
     {
-        if (m_pPoint != m_pMark)
-        {
-            SwPosition *pTmp = m_pPoint;
-            m_pPoint = m_pMark;
-            m_pMark = pTmp;
-        }
+        if (HasMark())
+            std::swap(m_pPoint, m_pMark);
     }
-#endif
 
     /** A PaM marks a selection if Point and Mark are distinct positions.
         @return     true if the PaM spans a selection
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 06690354a8b9..eafa38907fcd 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -652,18 +652,6 @@ void SwPaM::SetMark()
     (*m_pMark) = *m_pPoint;
 }
 
-#ifdef DBG_UTIL
-void SwPaM::Exchange()
-{
-    if (m_pPoint != m_pMark)
-    {
-        SwPosition *pTmp = m_pPoint;
-        m_pPoint = m_pMark;
-        m_pMark = pTmp;
-    }
-}
-#endif
-
 /// movement of cursor
 bool SwPaM::Move( SwMoveFnCollection const & fnMove, SwGoInDoc fnGo )
 {

Reply via email to