diff options
author | stanly <stanly@yandex-team.ru> | 2022-02-10 16:46:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:49 +0300 |
commit | cde218e65dfef5ce03a48d641fd8f7913cf17b2d (patch) | |
tree | d3349caea4095825a55b5ba24fe758067b29ce6f /util/memory | |
parent | 9f813499b4ef585cb3c2bb93de93ef003daf4fc4 (diff) | |
download | ydb-cde218e65dfef5ce03a48d641fd8f7913cf17b2d.tar.gz |
Restoring authorship annotation for <stanly@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/memory')
-rw-r--r-- | util/memory/pool.h | 16 | ||||
-rw-r--r-- | util/memory/segmented_string_pool.h | 12 |
2 files changed, 14 insertions, 14 deletions
diff --git a/util/memory/pool.h b/util/memory/pool.h index 13c8b6b9ed..58a5057b3c 100644 --- a/util/memory/pool.h +++ b/util/memory/pool.h @@ -8,7 +8,7 @@ #include <util/generic/utility.h> #include <util/generic/intrlist.h> #include <util/generic/strbuf.h> -#include <util/generic/singleton.h> +#include <util/generic/singleton.h> #include <new> #include <string> @@ -67,7 +67,7 @@ private: inline size_t Used() const noexcept { return Cur_ - (const char*)this; } - + inline size_t Left() const noexcept { return Left_; } @@ -146,7 +146,7 @@ public: inline ~TMemoryPool() { Clear(); } - + inline void* Allocate(size_t len) { return RawAllocate(AlignUp<size_t>(len, PLATFORM_DATA_ALIGN)); } @@ -231,7 +231,7 @@ public: *(ret + buf.size()) = 0; return TBasicStringBuf<TChar>(ret, buf.size()); } - + inline size_t Available() const noexcept { return Current_->Left(); } @@ -309,8 +309,8 @@ private: template <typename TPool> struct TPoolableBase { inline void* operator new(size_t bytes, TPool& pool) { - return pool.Allocate(bytes); - } + return pool.Allocate(bytes); + } inline void* operator new(size_t bytes, std::align_val_t align, TPool& pool) { return pool.Allocate(bytes, (size_t)align); @@ -324,8 +324,8 @@ struct TPoolableBase { private: inline void* operator new(size_t); // disallow default allocation -}; - +}; + struct TPoolable: public TPoolableBase<TMemoryPool> { }; diff --git a/util/memory/segmented_string_pool.h b/util/memory/segmented_string_pool.h index a40aa408f5..c02b28606b 100644 --- a/util/memory/segmented_string_pool.h +++ b/util/memory/segmented_string_pool.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/align.h> +#include <util/system/align.h> #include <util/system/yassert.h> #include <util/system/defaults.h> #include <util/generic/noncopyable.h> @@ -95,9 +95,9 @@ public: curseg->freepos += last_ins_size, last_free -= 1; return (T*)rv; } - size_t get_segment_size() const { - return segment_size; - } + size_t get_segment_size() const { + return segment_size; + } bool contains(const T* ptr) const { for (seg_const_iterator i = segs.begin(), ie = segs.end(); i != ie; ++i) if ((char*)ptr >= (char*)i->data && (char*)ptr < (char*)i->data + i->freepos) @@ -186,9 +186,9 @@ public: template <typename T, typename C> inline T* pool_push(segmented_pool<C>& pool, const T* v) { - static_assert(sizeof(C) == 1, "only char type supported"); + static_assert(sizeof(C) == 1, "only char type supported"); size_t len = SizeOf(v); - C* buf = pool.append(nullptr, AlignUp(len)); + C* buf = pool.append(nullptr, AlignUp(len)); memcpy(buf, v, len); return (T*)buf; } |