diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-09-30 10:18:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-09-30 11:06:19 +0200 |
commit | 2950528c51b175ae704c674010d8538e3e83da08 (patch) | |
tree | c39ba6a5e39238f7fe965ec1b2aada3065f1b208 /store/source/storbase.hxx | |
parent | 673fe197751cca6477c851f6a64674ced768bc49 (diff) |
No need for rtl_cache_* here
...which shows that m_pCount will never be null
Change-Id: I87c6e4bf5d258c59a8e91cd194c64b1ce85b4445
Diffstat (limited to 'store/source/storbase.hxx')
-rw-r--r-- | store/source/storbase.hxx | 38 |
1 files changed, 7 insertions, 31 deletions
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; } }; |