svl/Library_svl.mk            |    1 
 svl/source/items/itempool.cxx |   67 +++++++++++++++++++++++++++++
 svl/source/items/poolio.cxx   |   95 ------------------------------------------
 3 files changed, 67 insertions(+), 96 deletions(-)

New commits:
commit 827b218b94c64b658549bd0d4468783a7f1e231a
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Feb 22 00:10:31 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Feb 22 10:37:56 2022 +0100

    merge poolio.cxx into itempool.cxx
    
    It doesn't make sense to have few SfxItemPool functions in a separate
    source file, and without LTO those tiny functions do not get inlined,
    which is confusing when profiling.
    
    Change-Id: I0ba891ba51c7d8dd3eba3f4cae0f7819f9b033e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130327
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk
index 8dd746b2462c..116f9ba416af 100644
--- a/svl/Library_svl.mk
+++ b/svl/Library_svl.mk
@@ -133,7 +133,6 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
     svl/source/items/legacyitem \
     svl/source/items/macitem \
     svl/source/items/poolcach \
-    svl/source/items/poolio \
     svl/source/items/poolitem \
     svl/source/items/ptitem \
     svl/source/items/rectitem \
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index e13a1ffd60ea..579aad4005f8 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -86,6 +86,73 @@ do { \
 #define CHECK_SLOTS() do {} while (false)
 #endif
 
+/// clear array of PoolItem variants
+/// after all PoolItems are deleted
+/// or all ref counts are decreased
+void SfxPoolItemArray_Impl::clear()
+{
+    maPoolItemSet.clear();
+    maSortablePoolItems.clear();
+}
+
+sal_uInt16 SfxItemPool::GetFirstWhich() const
+{
+    return pImpl->mnStart;
+}
+
+sal_uInt16 SfxItemPool::GetLastWhich() const
+{
+    return pImpl->mnEnd;
+}
+
+bool SfxItemPool::IsInRange( sal_uInt16 nWhich ) const
+{
+    return nWhich >= pImpl->mnStart && nWhich <= pImpl->mnEnd;
+}
+
+sal_uInt16 SfxItemPool::GetIndex_Impl(sal_uInt16 nWhich) const
+{
+    if (nWhich < pImpl->mnStart || nWhich > pImpl->mnEnd)
+    {
+        assert(false && "missing bounds check before use");
+        return 0;
+    }
+    return nWhich - pImpl->mnStart;
+}
+
+sal_uInt16 SfxItemPool::GetSize_Impl() const
+{
+    return pImpl->mnEnd - pImpl->mnStart + 1;
+}
+
+
+bool SfxItemPool::CheckItemInPool(const SfxPoolItem *pItem) const
+{
+    DBG_ASSERT( pItem, "no 0-Pointer Surrogate" );
+    DBG_ASSERT( !IsInvalidItem(pItem), "no Invalid-Item Surrogate" );
+    DBG_ASSERT( !IsPoolDefaultItem(pItem), "no Pool-Default-Item Surrogate" );
+
+    if ( !IsInRange(pItem->Which()) )
+    {
+        if ( pImpl->mpSecondary )
+            return pImpl->mpSecondary->CheckItemInPool( pItem );
+        SAL_WARN( "svl.items", "unknown Which-Id - don't ask me for 
surrogates, with ID/pos " << pItem->Which());
+    }
+
+    // Pointer on static or pool-default attribute?
+    if( IsStaticDefaultItem(pItem) || IsPoolDefaultItem(pItem) )
+        return true;
+
+    SfxPoolItemArray_Impl& rItemArr = 
pImpl->maPoolItemArrays[GetIndex_Impl(pItem->Which())];
+
+    for ( auto p : rItemArr )
+    {
+        if ( p == pItem )
+            return true;
+    }
+    SAL_WARN( "svl.items", "Item not in the pool, with ID/pos " << 
pItem->Which());
+    return false;
+}
 
 const SfxPoolItem* SfxItemPool::GetPoolDefaultItem( sal_uInt16 nWhich ) const
 {
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
deleted file mode 100644
index 14613824eae4..000000000000
--- a/svl/source/items/poolio.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <poolio.hxx>
-
-#include <sal/log.hxx>
-#include <svl/itempool.hxx>
-
-#include <memory>
-
-/// clear array of PoolItem variants
-/// after all PoolItems are deleted
-/// or all ref counts are decreased
-void SfxPoolItemArray_Impl::clear()
-{
-    maPoolItemSet.clear();
-    maSortablePoolItems.clear();
-}
-
-sal_uInt16 SfxItemPool::GetFirstWhich() const
-{
-    return pImpl->mnStart;
-}
-
-sal_uInt16 SfxItemPool::GetLastWhich() const
-{
-    return pImpl->mnEnd;
-}
-
-bool SfxItemPool::IsInRange( sal_uInt16 nWhich ) const
-{
-    return nWhich >= pImpl->mnStart && nWhich <= pImpl->mnEnd;
-}
-
-sal_uInt16 SfxItemPool::GetIndex_Impl(sal_uInt16 nWhich) const
-{
-    if (nWhich < pImpl->mnStart || nWhich > pImpl->mnEnd)
-    {
-        assert(false && "missing bounds check before use");
-        return 0;
-    }
-    return nWhich - pImpl->mnStart;
-}
-
-sal_uInt16 SfxItemPool::GetSize_Impl() const
-{
-    return pImpl->mnEnd - pImpl->mnStart + 1;
-}
-
-
-bool SfxItemPool::CheckItemInPool(const SfxPoolItem *pItem) const
-{
-    DBG_ASSERT( pItem, "no 0-Pointer Surrogate" );
-    DBG_ASSERT( !IsInvalidItem(pItem), "no Invalid-Item Surrogate" );
-    DBG_ASSERT( !IsPoolDefaultItem(pItem), "no Pool-Default-Item Surrogate" );
-
-    if ( !IsInRange(pItem->Which()) )
-    {
-        if ( pImpl->mpSecondary )
-            return pImpl->mpSecondary->CheckItemInPool( pItem );
-        SAL_WARN( "svl.items", "unknown Which-Id - don't ask me for 
surrogates, with ID/pos " << pItem->Which());
-    }
-
-    // Pointer on static or pool-default attribute?
-    if( IsStaticDefaultItem(pItem) || IsPoolDefaultItem(pItem) )
-        return true;
-
-    SfxPoolItemArray_Impl& rItemArr = 
pImpl->maPoolItemArrays[GetIndex_Impl(pItem->Which())];
-
-    for ( auto p : rItemArr )
-    {
-        if ( p == pItem )
-            return true;
-    }
-    SAL_WARN( "svl.items", "Item not in the pool, with ID/pos " << 
pItem->Which());
-    return false;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to