diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-05 20:01:10 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-05 20:01:10 +0200 |
commit | c3b63b831cd2c64700e875b28540212c7c881ac6 (patch) | |
tree | edd98fcbd2004d3b562904f822bf6c3322fc7f52 /toolkit/crashreporter/jsoncpp/include/json/allocator.h | |
parent | d432e068a21c815d5d5e7bcbc1cc8c6e77a7d1e0 (diff) | |
parent | cc07da9cb4d6e7a53f8d953427ffc2bca2e0c2df (diff) | |
download | UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.gz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.lz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.xz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.zip |
Merge branch 'master' into 816
Diffstat (limited to 'toolkit/crashreporter/jsoncpp/include/json/allocator.h')
-rw-r--r-- | toolkit/crashreporter/jsoncpp/include/json/allocator.h | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/toolkit/crashreporter/jsoncpp/include/json/allocator.h b/toolkit/crashreporter/jsoncpp/include/json/allocator.h deleted file mode 100644 index 9d8b9fc9c..000000000 --- a/toolkit/crashreporter/jsoncpp/include/json/allocator.h +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED -#define CPPTL_JSON_ALLOCATOR_H_INCLUDED - -#include <cstring> -#include <memory> - -namespace Json { -template<typename T> -class SecureAllocator { - public: - // Type definitions - using value_type = T; - using pointer = T*; - using const_pointer = const T*; - using reference = T&; - using const_reference = const T&; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - /** - * Allocate memory for N items using the standard allocator. - */ - pointer allocate(size_type n) { - // allocate using "global operator new" - return static_cast<pointer>(::operator new(n * sizeof(T))); - } - - /** - * Release memory which was allocated for N items at pointer P. - * - * The memory block is filled with zeroes before being released. - * The pointer argument is tagged as "volatile" to prevent the - * compiler optimizing out this critical step. - */ - void deallocate(volatile pointer p, size_type n) { - std::memset(p, 0, n * sizeof(T)); - // free using "global operator delete" - ::operator delete(p); - } - - /** - * Construct an item in-place at pointer P. - */ - template<typename... Args> - void construct(pointer p, Args&&... args) { - // construct using "placement new" and "perfect forwarding" - ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...); - } - - size_type max_size() const { - return size_t(-1) / sizeof(T); - } - - pointer address( reference x ) const { - return std::addressof(x); - } - - const_pointer address( const_reference x ) const { - return std::addressof(x); - } - - /** - * Destroy an item in-place at pointer P. - */ - void destroy(pointer p) { - // destroy using "explicit destructor" - p->~T(); - } - - // Boilerplate - SecureAllocator() {} - template<typename U> SecureAllocator(const SecureAllocator<U>&) {} - template<typename U> struct rebind { using other = SecureAllocator<U>; }; -}; - - -template<typename T, typename U> -bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) { - return true; -} - -template<typename T, typename U> -bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) { - return false; -} - -} //namespace Json - -#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED |