summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-09-30 20:22:30 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-10-01 06:33:11 +0200
commit1fc63383ccd8af144d681ba405f5ead863ac24e1 (patch)
tree77d41033131babef8db1dd7ffb6e00b0f0ac3237 /sw/source/core/layout
parent4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (diff)
Avoid redundant IsAtEnd: NextItem returns nullptr iif iterator is at end
To keep the check efficient, split NextItem to inline and Impl parts Change-Id: Id5877a3c5bed73aac9c39c655b106a715cf888ea Reviewed-on: https://gerrit.libreoffice.org/79894 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/fly.cxx16
-rw-r--r--sw/source/core/layout/pagechg.cxx16
-rw-r--r--sw/source/core/layout/sectfrm.cxx16
-rw-r--r--sw/source/core/layout/tabfrm.cxx16
-rw-r--r--sw/source/core/layout/wsfrm.cxx31
5 files changed, 42 insertions, 53 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 728c191d753f..33b5e194e160 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -643,18 +643,16 @@ void SwFlyFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
{
SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() );
SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
+ const SfxPoolItem* pNItem = aNIter.GetCurItem();
+ const SfxPoolItem* pOItem = aOIter.GetCurItem();
SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) );
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
- while( true )
+ do
{
- UpdateAttr_( aOIter.GetCurItem(),
- aNIter.GetCurItem(), nInvFlags,
- &aOldSet, &aNewSet );
- if( aNIter.IsAtEnd() )
- break;
- aNIter.NextItem();
- aOIter.NextItem();
- }
+ UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+ pNItem = aNIter.NextItem();
+ pOItem = aOIter.NextItem();
+ } while (pNItem);
if ( aOldSet.Count() || aNewSet.Count() )
SwLayoutFrame::Modify( &aOldSet, &aNewSet );
}
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 284f92a97556..a2b70fb68e81 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -507,18 +507,16 @@ void SwPageFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
{
SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() );
SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
+ const SfxPoolItem* pNItem = aNIter.GetCurItem();
+ const SfxPoolItem* pOItem = aOIter.GetCurItem();
SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) );
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
- while( true )
+ do
{
- UpdateAttr_( aOIter.GetCurItem(),
- aNIter.GetCurItem(), nInvFlags,
- &aOldSet, &aNewSet );
- if( aNIter.IsAtEnd() )
- break;
- aNIter.NextItem();
- aOIter.NextItem();
- }
+ UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+ pNItem = aNIter.NextItem();
+ pOItem = aOIter.NextItem();
+ } while (pNItem);
if ( aOldSet.Count() || aNewSet.Count() )
SwLayoutFrame::Modify( &aOldSet, &aNewSet );
}
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index e64301f8fbe4..7c71e6c44e33 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2569,18 +2569,16 @@ void SwSectionFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
{
SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() );
SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
+ const SfxPoolItem* pNItem = aNIter.GetCurItem();
+ const SfxPoolItem* pOItem = aOIter.GetCurItem();
SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) );
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
- while( true )
+ do
{
- UpdateAttr_( aOIter.GetCurItem(),
- aNIter.GetCurItem(), nInvFlags,
- &aOldSet, &aNewSet );
- if( aNIter.IsAtEnd() )
- break;
- aNIter.NextItem();
- aOIter.NextItem();
- }
+ UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+ pNItem = aNIter.NextItem();
+ pOItem = aOIter.NextItem();
+ } while (pNItem);
if ( aOldSet.Count() || aNewSet.Count() )
SwLayoutFrame::Modify( &aOldSet, &aNewSet );
}
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index bfe8a7a9e4ea..4395bd231900 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3164,18 +3164,16 @@ void SwTabFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
{
SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() );
SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
+ const SfxPoolItem* pNItem = aNIter.GetCurItem();
+ const SfxPoolItem* pOItem = aOIter.GetCurItem();
SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) );
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
- while( true )
+ do
{
- UpdateAttr_( aOIter.GetCurItem(),
- aNIter.GetCurItem(), nInvFlags,
- &aOldSet, &aNewSet );
- if( aNIter.IsAtEnd() )
- break;
- aNIter.NextItem();
- aOIter.NextItem();
- }
+ UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+ pNItem = aNIter.NextItem();
+ pOItem = aOIter.NextItem();
+ } while (pNItem);
if ( aOldSet.Count() || aNewSet.Count() )
SwLayoutFrame::Modify( &aOldSet, &aNewSet );
}
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 62eca76b99a8..f17a7ba68870 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -479,15 +479,14 @@ void SwFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
{
SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() );
SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
- while( true )
+ const SfxPoolItem* pNItem = aNIter.GetCurItem();
+ const SfxPoolItem* pOItem = aOIter.GetCurItem();
+ do
{
- UpdateAttrFrame( aOIter.GetCurItem(),
- aNIter.GetCurItem(), nInvFlags );
- if( aNIter.IsAtEnd() )
- break;
- aNIter.NextItem();
- aOIter.NextItem();
- }
+ UpdateAttrFrame(pOItem, pNItem, nInvFlags);
+ pNItem = aNIter.NextItem();
+ pOItem = aOIter.NextItem();
+ } while (pNItem);
}
else
UpdateAttrFrame( pOld, pNew, nInvFlags );
@@ -2308,18 +2307,16 @@ void SwContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
{
SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() );
SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
+ const SfxPoolItem* pNItem = aNIter.GetCurItem();
+ const SfxPoolItem* pOItem = aOIter.GetCurItem();
SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) );
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
- while( true )
+ do
{
- UpdateAttr_( aOIter.GetCurItem(),
- aNIter.GetCurItem(), nInvFlags,
- &aOldSet, &aNewSet );
- if( aNIter.IsAtEnd() )
- break;
- aNIter.NextItem();
- aOIter.NextItem();
- }
+ UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+ pNItem = aNIter.NextItem();
+ pOItem = aOIter.NextItem();
+ } while (pNItem);
if ( aOldSet.Count() || aNewSet.Count() )
SwFrame::Modify( &aOldSet, &aNewSet );
}