sw/source/core/bastyp/swcache.cxx |   13 +++++--------
 sw/source/core/inc/swcache.hxx    |    8 +++++---
 2 files changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 8caf588bb5d1c2babd6a331dad8d27aa9491ae6c
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Aug 30 10:32:04 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 30 15:48:05 2022 +0200

    add some comments to SwCache and de-indent a little
    
    Change-Id: Ie4390aa0b55f46bc0937c6858ca6fd08393e02a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139034
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/bastyp/swcache.cxx 
b/sw/source/core/bastyp/swcache.cxx
index cf4e8e135454..1affca644884 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -151,17 +151,14 @@ void SwCache::Flush()
     INCREMENT( m_nFlushCnt );
     SwCacheObj *pObj = m_pRealFirst;
     m_pRealFirst = m_pFirst = m_pLast = nullptr;
-    SwCacheObj *pTmp;
     while ( pObj )
     {
         assert(!pObj->IsLocked());
-        {
-            pTmp = pObj;
-            pObj = pTmp->GetNext();
-            m_aFreePositions.push_back( pTmp->GetCachePos() );
-            m_aCacheObjects[pTmp->GetCachePos()].reset(); // deletes pTmp
-            INCREMENT( m_nFlushedObjects );
-        }
+        SwCacheObj *pTmp = pObj;
+        pObj = pTmp->GetNext();
+        m_aFreePositions.push_back( pTmp->GetCachePos() );
+        m_aCacheObjects[pTmp->GetCachePos()].reset(); // deletes pTmp
+        INCREMENT( m_nFlushedObjects );
     }
 }
 
diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx
index f5a01643771a..df8ed2a64ebf 100644
--- a/sw/source/core/inc/swcache.hxx
+++ b/sw/source/core/inc/swcache.hxx
@@ -55,9 +55,9 @@ class SwCache
 {
     std::vector<std::unique_ptr<SwCacheObj>> m_aCacheObjects;
     std::vector<sal_uInt16> m_aFreePositions; /// Free positions for the 
Insert if the maximum has not been reached
-                                            /// Every time an object is 
deregistered, its position is added here
+                                              /// Every time an object is 
deregistered, its position is added here
     SwCacheObj *m_pRealFirst;                 /// _ALWAYS_ the real first LRU
-    SwCacheObj *m_pFirst;                     /// The virtual first
+    SwCacheObj *m_pFirst;                     /// The virtual first, only 
different to m_pRealFirst when SetLRUOfst has been called
     SwCacheObj *m_pLast;
 
     sal_uInt16 m_nCurMax;                     // Maximum of accepted objects
@@ -106,7 +106,9 @@ public:
     void Delete(const void * pOwner, sal_uInt16 nIndex);
     void Delete( const void *pOwner );
 
-    void SetLRUOfst( const sal_uInt16 nOfst );  /// nOfst determines how many 
are not to be touched
+    /// Mark some entries as "do not delete"
+    /// @param nOfst determines how many are not to be touched
+    void SetLRUOfst( const sal_uInt16 nOfst );
     void ResetLRUOfst() { m_pFirst = m_pRealFirst; }
 
     void IncreaseMax( const sal_uInt16 nAdd );

Reply via email to