diff options
Diffstat (limited to 'Swiften/Base/SafeAllocator.h')
-rw-r--r-- | Swiften/Base/SafeAllocator.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Swiften/Base/SafeAllocator.h b/Swiften/Base/SafeAllocator.h index 07bec70..0369ec4 100644 --- a/Swiften/Base/SafeAllocator.h +++ b/Swiften/Base/SafeAllocator.h @@ -12,25 +12,25 @@ #include <Swiften/Base/API.h> namespace Swift { - void secureZeroMemory(char* memory, size_t numberOfBytes); - - template<typename T> - class SWIFTEN_API SafeAllocator : public std::allocator<T> { - public: - template <class U> struct rebind { - typedef SafeAllocator<U> other; - }; - - SafeAllocator() SWIFTEN_NOEXCEPT {} - SafeAllocator(const SafeAllocator&) SWIFTEN_NOEXCEPT : std::allocator<T>() {} - template <class U> SafeAllocator(const SafeAllocator<U>&) SWIFTEN_NOEXCEPT {} - ~SafeAllocator() SWIFTEN_NOEXCEPT {} - - void deallocate (T* p, size_t num) { - secureZeroMemory(reinterpret_cast<char*>(p), num); - std::allocator<T>::deallocate(p, num); - } - - SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(SafeAllocator) - }; + void secureZeroMemory(char* memory, size_t numberOfBytes); + + template<typename T> + class SWIFTEN_API SafeAllocator : public std::allocator<T> { + public: + template <class U> struct rebind { + typedef SafeAllocator<U> other; + }; + + SafeAllocator() SWIFTEN_NOEXCEPT {} + SafeAllocator(const SafeAllocator&) SWIFTEN_NOEXCEPT : std::allocator<T>() {} + template <class U> SafeAllocator(const SafeAllocator<U>&) SWIFTEN_NOEXCEPT {} + ~SafeAllocator() SWIFTEN_NOEXCEPT {} + + void deallocate (T* p, size_t num) { + secureZeroMemory(reinterpret_cast<char*>(p), num); + std::allocator<T>::deallocate(p, num); + } + + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(SafeAllocator) + }; } |