From 23702633342906f98ccebd2d651ea58f36b01c1b Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 30 Dec 2020 06:02:57 -0500 Subject: Add parameter to CRYPTOPP_INHERIT_ALLOCATOR_TYPES This allows us to specialize the allocators based on type. --- secblock.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'secblock.h') diff --git a/secblock.h b/secblock.h index 1531e28f..810eabf4 100644 --- a/secblock.h +++ b/secblock.h @@ -126,14 +126,14 @@ protected: } }; -#define CRYPTOPP_INHERIT_ALLOCATOR_TYPES \ -typedef typename AllocatorBase::value_type value_type;\ -typedef typename AllocatorBase::size_type size_type;\ -typedef typename AllocatorBase::difference_type difference_type;\ -typedef typename AllocatorBase::pointer pointer;\ -typedef typename AllocatorBase::const_pointer const_pointer;\ -typedef typename AllocatorBase::reference reference;\ -typedef typename AllocatorBase::const_reference const_reference; +#define CRYPTOPP_INHERIT_ALLOCATOR_TYPES(T_type) \ + typedef typename AllocatorBase::value_type value_type;\ + typedef typename AllocatorBase::size_type size_type;\ + typedef typename AllocatorBase::difference_type difference_type;\ + typedef typename AllocatorBase::pointer pointer;\ + typedef typename AllocatorBase::const_pointer const_pointer;\ + typedef typename AllocatorBase::reference reference;\ + typedef typename AllocatorBase::const_reference const_reference; /// \brief Reallocation function /// \tparam T the class or type @@ -187,7 +187,7 @@ template class AllocatorWithCleanup : public AllocatorBase { public: - CRYPTOPP_INHERIT_ALLOCATOR_TYPES + CRYPTOPP_INHERIT_ALLOCATOR_TYPES(T) /// \brief Allocates a block of memory /// \param ptr the size of the allocation @@ -299,7 +299,7 @@ class NullAllocator : public AllocatorBase { public: //LCOV_EXCL_START - CRYPTOPP_INHERIT_ALLOCATOR_TYPES + CRYPTOPP_INHERIT_ALLOCATOR_TYPES(T) // TODO: should this return NULL or throw bad_alloc? Non-Windows C++ standard // libraries always throw. And late mode Windows throws. Early model Windows @@ -354,7 +354,7 @@ template class FixedSizeAllocatorWithCleanup : public AllocatorBase { public: - CRYPTOPP_INHERIT_ALLOCATOR_TYPES + CRYPTOPP_INHERIT_ALLOCATOR_TYPES(T) /// \brief Constructs a FixedSizeAllocatorWithCleanup FixedSizeAllocatorWithCleanup() : m_allocated(false) {} @@ -578,7 +578,7 @@ template class FixedSizeAllocatorWithCleanup : public AllocatorBase { public: - CRYPTOPP_INHERIT_ALLOCATOR_TYPES + CRYPTOPP_INHERIT_ALLOCATOR_TYPES(T) /// \brief Constructs a FixedSizeAllocatorWithCleanup FixedSizeAllocatorWithCleanup() : m_allocated(false) {} -- cgit v1.2.1