diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-02-10 16:46:29 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:29 +0300 |
commit | f773626848a7c7456803654292e716b83d69cc12 (patch) | |
tree | db052dfcf9134f492bdbb962cb6c16cea58e1ed3 /util/memory | |
parent | f43ab775d197d300eb67bd4497632b909cd7c2a5 (diff) | |
download | ydb-f773626848a7c7456803654292e716b83d69cc12.tar.gz |
Restoring authorship annotation for Andrey Khalyavin <halyavin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/memory')
-rw-r--r-- | util/memory/alloc.h | 2 | ||||
-rw-r--r-- | util/memory/pool.h | 6 | ||||
-rw-r--r-- | util/memory/segpool_alloc.h | 4 | ||||
-rw-r--r-- | util/memory/smallobj.h | 24 |
4 files changed, 18 insertions, 18 deletions
diff --git a/util/memory/alloc.h b/util/memory/alloc.h index d59575aef5..36367a7eef 100644 --- a/util/memory/alloc.h +++ b/util/memory/alloc.h @@ -3,7 +3,7 @@ #include <memory> template <class Allocator, class T> -using TReboundAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<T>; +using TReboundAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<T>; class IAllocator { public: diff --git a/util/memory/pool.h b/util/memory/pool.h index 13c8b6b9ed..626bee0ddd 100644 --- a/util/memory/pool.h +++ b/util/memory/pool.h @@ -212,7 +212,7 @@ public: template <typename TChar> inline TChar* Append(const TChar* str, size_t len) { - TChar* ret = AllocateArray<TChar>(len); + TChar* ret = AllocateArray<TChar>(len); std::char_traits<TChar>::copy(ret, str, len); return ret; @@ -417,8 +417,8 @@ private: template <class T> using TPoolAlloc = TPoolAllocBase<T, TMemoryPool>; -// Any type since it is supposed to be rebound anyway. -using TPoolAllocator = TPoolAlloc<int>; +// Any type since it is supposed to be rebound anyway. +using TPoolAllocator = TPoolAlloc<int>; template <class T> inline bool operator==(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept { diff --git a/util/memory/segpool_alloc.h b/util/memory/segpool_alloc.h index 1a83b7a543..fa3ea7d90d 100644 --- a/util/memory/segpool_alloc.h +++ b/util/memory/segpool_alloc.h @@ -114,5 +114,5 @@ inline bool operator!=(const segpool_alloc<_Tp>& a1, const segpool_alloc<_Tp>& a return a1.pool != a2.pool; } -// Any type since it is supposed to be rebound anyway. -using segpool_alloc_vt = segpool_alloc<int>; +// Any type since it is supposed to be rebound anyway. +using segpool_alloc_vt = segpool_alloc<int>; diff --git a/util/memory/smallobj.h b/util/memory/smallobj.h index 63de666bae..cb0490ab31 100644 --- a/util/memory/smallobj.h +++ b/util/memory/smallobj.h @@ -107,17 +107,17 @@ private: template <class T> class TObjectFromPool { public: - struct THeader { - void* Pool; - // Can't just use T because THeader must be standard layout type for offsetof to work. - alignas(T) char Obj[sizeof(T)]; - }; - using TPool = TSmallObjAllocator<THeader>; + struct THeader { + void* Pool; + // Can't just use T because THeader must be standard layout type for offsetof to work. + alignas(T) char Obj[sizeof(T)]; + }; + using TPool = TSmallObjAllocator<THeader>; inline void* operator new(size_t, TPool* pool) { - THeader* ret = pool->Allocate(); - ret->Pool = pool; - return &ret->Obj; + THeader* ret = pool->Allocate(); + ret->Pool = pool; + return &ret->Obj; } inline void operator delete(void* ptr, size_t) noexcept { @@ -134,8 +134,8 @@ public: private: static inline void DoDelete(void* ptr) noexcept { - static_assert(std::is_standard_layout<THeader>::value, "offsetof is only defined for standard layout types"); - THeader* header = (THeader*)((char*)ptr - offsetof(THeader, Obj)); - ((TPool*)header->Pool)->Release(header); + static_assert(std::is_standard_layout<THeader>::value, "offsetof is only defined for standard layout types"); + THeader* header = (THeader*)((char*)ptr - offsetof(THeader, Obj)); + ((TPool*)header->Pool)->Release(header); } }; |