svl/source/items/itemiter.cxx |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit 30fd34422ce0939dc1f7a5587a93b1bd991cd766
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun May 11 09:13:01 2025 +0200
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon May 12 11:08:23 2025 +0200

    Optimize SfxItemIter::GetItemState using SfxItemSet::GetItemState_ForIter
    
    Avoids a lookup in the unordered map, where we already have an iterator.
    
    Change-Id: Ie65c588a9ec7b7c3c1ad3ba2181f6c76ec9b7e9c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185168
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit 3072f7cbadf456814db2b4857e5931ca7a48ab51)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185194
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/svl/source/items/itemiter.cxx b/svl/source/items/itemiter.cxx
index 6eaa33dc5702..652c511e56da 100644
--- a/svl/source/items/itemiter.cxx
+++ b/svl/source/items/itemiter.cxx
@@ -25,16 +25,13 @@ SfxItemState SfxItemIter::GetItemState(bool bSrchInParent, 
const SfxPoolItem** p
     if (IsAtEnd())
         return SfxItemState::UNKNOWN;
 
-    const sal_uInt16 nWhich(maCurrent->first);
-    SfxItemState eState(
-        m_rSet.GetItemState_ForWhichID(SfxItemState::UNKNOWN, nWhich, true, 
ppItem));
+    SfxItemState eState(SfxItemSet::GetItemState_ForIter(maCurrent, ppItem));
 
     // search in parent?
     if (bSrchInParent && nullptr != m_rSet.GetParent()
         && (SfxItemState::UNKNOWN == eState || SfxItemState::DEFAULT == 
eState))
     {
-        // nOffset was only valid for *local* SfxItemSet, need to continue 
with WhichID
-        // const sal_uInt16 nWhich(m_rSet.GetWhichByOffset(m_nCurrent));
+        const sal_uInt16 nWhich(maCurrent->first);
         eState = m_rSet.GetParent()->GetItemState_ForWhichID(eState, nWhich, 
true, ppItem);
     }
 

Reply via email to