aboutsummaryrefslogtreecommitdiffstats
path: root/util/memory
diff options
context:
space:
mode:
authorswarmer <swarmer@yandex-team.ru>2022-02-10 16:46:31 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:31 +0300
commit317da38588b7898a99fd9168571408123350012b (patch)
tree25eebc31526019ad39a6c1b13f492963d97ba439 /util/memory
parent3b2241461d41d41ba1a706b0750c4f0f55c344f6 (diff)
downloadydb-317da38588b7898a99fd9168571408123350012b.tar.gz
Restoring authorship annotation for <swarmer@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/memory')
-rw-r--r--util/memory/addstorage.h74
-rw-r--r--util/memory/benchmark/pool/metrics/ya.make2
-rw-r--r--util/memory/benchmark/pool/ya.make2
-rw-r--r--util/memory/benchmark/ya.make2
-rw-r--r--util/memory/blob.h12
-rw-r--r--util/memory/ut/ya.make2
-rw-r--r--util/memory/ya.make10
7 files changed, 52 insertions, 52 deletions
diff --git a/util/memory/addstorage.h b/util/memory/addstorage.h
index 597c73a988..81c8260b9d 100644
--- a/util/memory/addstorage.h
+++ b/util/memory/addstorage.h
@@ -5,40 +5,40 @@
#include <new>
-namespace NPrivate {
- class TAdditionalStorageInfo {
+namespace NPrivate {
+ class TAdditionalStorageInfo {
public:
- constexpr TAdditionalStorageInfo(size_t length) noexcept
- : Length_(length)
- {
+ constexpr TAdditionalStorageInfo(size_t length) noexcept
+ : Length_(length)
+ {
}
- constexpr size_t Length() const noexcept {
- return Length_;
+ constexpr size_t Length() const noexcept {
+ return Length_;
}
private:
- size_t Length_;
+ size_t Length_;
};
-}
-
-template <class T>
-class alignas(::NPrivate::TAdditionalStorageInfo) TAdditionalStorage {
- using TInfo = ::NPrivate::TAdditionalStorageInfo;
+}
+template <class T>
+class alignas(::NPrivate::TAdditionalStorageInfo) TAdditionalStorage {
+ using TInfo = ::NPrivate::TAdditionalStorageInfo;
+
public:
inline TAdditionalStorage() noexcept = default;
inline ~TAdditionalStorage() = default;
inline void* operator new(size_t len1, size_t len2) {
- static_assert(alignof(T) >= alignof(TInfo));
- Y_ASSERT(len1 == sizeof(T));
- void* data = ::operator new(CombinedSizeOfInstanceWithTInfo() + len2);
- void* info = InfoPtr(static_cast<T*>(data));
- Y_UNUSED(new (info) TInfo(len2));
+ static_assert(alignof(T) >= alignof(TInfo));
+ Y_ASSERT(len1 == sizeof(T));
+ void* data = ::operator new(CombinedSizeOfInstanceWithTInfo() + len2);
+ void* info = InfoPtr(static_cast<T*>(data));
+ Y_UNUSED(new (info) TInfo(len2));
- return data;
+ return data;
}
inline void operator delete(void* ptr) noexcept {
@@ -58,36 +58,36 @@ public:
}
inline void* AdditionalData() const noexcept {
- return (char*)(static_cast<const T*>(this)) + CombinedSizeOfInstanceWithTInfo();
+ return (char*)(static_cast<const T*>(this)) + CombinedSizeOfInstanceWithTInfo();
}
static inline T* ObjectFromData(void* data) noexcept {
- return reinterpret_cast<T*>(static_cast<char*>(data) - CombinedSizeOfInstanceWithTInfo());
+ return reinterpret_cast<T*>(static_cast<char*>(data) - CombinedSizeOfInstanceWithTInfo());
}
inline size_t AdditionalDataLength() const noexcept {
- return InfoPtr(static_cast<const T*>(this))->Length();
+ return InfoPtr(static_cast<const T*>(this))->Length();
}
private:
static inline void DoDelete(void* ptr) noexcept {
- TInfo* info = InfoPtr(static_cast<T*>(ptr));
+ TInfo* info = InfoPtr(static_cast<T*>(ptr));
info->~TInfo();
- ::operator delete(ptr);
- }
-
- static constexpr size_t CombinedSizeOfInstanceWithTInfo() noexcept {
- return AlignUp(sizeof(T), alignof(TInfo)) + sizeof(TInfo);
- }
-
- static constexpr TInfo* InfoPtr(T* instance) noexcept {
- return const_cast<TInfo*>(InfoPtr(static_cast<const T*>(instance)));
- }
-
- static constexpr const TInfo* InfoPtr(const T* instance) noexcept {
- return reinterpret_cast<const TInfo*>(reinterpret_cast<const char*>(instance) + CombinedSizeOfInstanceWithTInfo() - sizeof(TInfo));
+ ::operator delete(ptr);
}
+ static constexpr size_t CombinedSizeOfInstanceWithTInfo() noexcept {
+ return AlignUp(sizeof(T), alignof(TInfo)) + sizeof(TInfo);
+ }
+
+ static constexpr TInfo* InfoPtr(T* instance) noexcept {
+ return const_cast<TInfo*>(InfoPtr(static_cast<const T*>(instance)));
+ }
+
+ static constexpr const TInfo* InfoPtr(const T* instance) noexcept {
+ return reinterpret_cast<const TInfo*>(reinterpret_cast<const char*>(instance) + CombinedSizeOfInstanceWithTInfo() - sizeof(TInfo));
+ }
+
private:
- void* operator new(size_t) = delete;
+ void* operator new(size_t) = delete;
};
diff --git a/util/memory/benchmark/pool/metrics/ya.make b/util/memory/benchmark/pool/metrics/ya.make
index c671bc5c1c..5dcd3f8343 100644
--- a/util/memory/benchmark/pool/metrics/ya.make
+++ b/util/memory/benchmark/pool/metrics/ya.make
@@ -1,5 +1,5 @@
OWNER(g:util)
-SUBSCRIBER(g:util-subscribers)
+SUBSCRIBER(g:util-subscribers)
PY2TEST()
diff --git a/util/memory/benchmark/pool/ya.make b/util/memory/benchmark/pool/ya.make
index 5f4f7d3f15..85199aa3af 100644
--- a/util/memory/benchmark/pool/ya.make
+++ b/util/memory/benchmark/pool/ya.make
@@ -1,5 +1,5 @@
OWNER(g:util)
-SUBSCRIBER(g:util-subscribers)
+SUBSCRIBER(g:util-subscribers)
Y_BENCHMARK()
diff --git a/util/memory/benchmark/ya.make b/util/memory/benchmark/ya.make
index 2259b9434e..0fe18aae9d 100644
--- a/util/memory/benchmark/ya.make
+++ b/util/memory/benchmark/ya.make
@@ -1,5 +1,5 @@
OWNER(g:util)
-SUBSCRIBER(g:util-subscribers)
+SUBSCRIBER(g:util-subscribers)
RECURSE(
pool
diff --git a/util/memory/blob.h b/util/memory/blob.h
index 20c02a68df..d13b2d3db4 100644
--- a/util/memory/blob.h
+++ b/util/memory/blob.h
@@ -74,12 +74,12 @@ public:
Ref();
}
- TBlob(TBlob&& r) noexcept
- : TBlob()
- {
- this->Swap(r);
- }
-
+ TBlob(TBlob&& r) noexcept
+ : TBlob()
+ {
+ this->Swap(r);
+ }
+
inline TBlob(const void* data, size_t length, TBase* base) noexcept
: S_(data, length, base)
{
diff --git a/util/memory/ut/ya.make b/util/memory/ut/ya.make
index d3a988617d..69ec434d04 100644
--- a/util/memory/ut/ya.make
+++ b/util/memory/ut/ya.make
@@ -1,7 +1,7 @@
UNITTEST_FOR(util)
OWNER(g:util)
-SUBSCRIBER(g:util-subscribers)
+SUBSCRIBER(g:util-subscribers)
SRCS(
memory/addstorage_ut.cpp
diff --git a/util/memory/ya.make b/util/memory/ya.make
index 79c9498ddd..24723ab579 100644
--- a/util/memory/ya.make
+++ b/util/memory/ya.make
@@ -1,6 +1,6 @@
OWNER(g:util)
-SUBSCRIBER(g:util-subscribers)
-
-RECURSE_FOR_TESTS(
- ut
-)
+SUBSCRIBER(g:util-subscribers)
+
+RECURSE_FOR_TESTS(
+ ut
+)