diff options
-rw-r--r-- | store/source/storbase.cxx | 33 | ||||
-rw-r--r-- | store/source/storbase.hxx | 38 |
2 files changed, 7 insertions, 64 deletions
diff --git a/store/source/storbase.cxx b/store/source/storbase.cxx index bb2cf277fd04..7e2a8cde8699 100644 --- a/store/source/storbase.cxx +++ b/store/source/storbase.cxx @@ -33,39 +33,6 @@ using namespace store; /*======================================================================== * - * SharedCount::Allocator. - * - *======================================================================*/ -SharedCount::Allocator & -SharedCount::Allocator::get() -{ - static Allocator g_aSharedCountAllocator; - return g_aSharedCountAllocator; -} - -SharedCount::Allocator::Allocator() -{ - m_cache = rtl_cache_create ( - "store_shared_count_cache", - sizeof(long), - 0, // objalign - nullptr, // constructor - nullptr, // destructor - nullptr, // reclaim - nullptr, // userarg - nullptr, // default source - 0 // flags - ); -} - -SharedCount::Allocator::~Allocator() -{ - rtl_cache_destroy (m_cache); - m_cache = nullptr; -} - -/*======================================================================== - * * PageData::Allocator_Impl (default allocator). * *======================================================================*/ diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index b861047c56bd..a4be84752c2f 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -84,42 +84,18 @@ class SharedCount { long * m_pCount; - class Allocator - { - rtl_cache_type * m_cache; - - public: - static Allocator & get(); - - long * alloc() - { - return static_cast<long*>(rtl_cache_alloc (m_cache)); - } - void free (long * pCount) - { - rtl_cache_free (m_cache, pCount); - } - - protected: - Allocator(); - ~Allocator(); - }; - public: SharedCount() - : m_pCount(Allocator::get().alloc()) + : m_pCount(new long) { - if (m_pCount != nullptr) (*m_pCount) = 1; + (*m_pCount) = 1; } ~SharedCount() { - if (m_pCount != nullptr) - { - long new_count = --(*m_pCount); - if (new_count == 0) - Allocator::get().free(m_pCount); - } + long new_count = --(*m_pCount); + if (new_count == 0) + delete m_pCount; } void swap (SharedCount & rhs) // nothrow @@ -130,7 +106,7 @@ public: SharedCount (SharedCount const & rhs) // nothrow : m_pCount (rhs.m_pCount) { - if (m_pCount != nullptr) ++(*m_pCount); + ++(*m_pCount); } SharedCount & operator= (SharedCount const & rhs) // nothrow { @@ -141,7 +117,7 @@ public: bool operator== (long count) const { - return (m_pCount != nullptr) && (*m_pCount == count); + return *m_pCount == count; } }; |