aboutsummaryrefslogtreecommitdiffstats
path: root/util/memory
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/memory
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'util/memory')
-rw-r--r--util/memory/addstorage.h14
-rw-r--r--util/memory/alloc.cpp2
-rw-r--r--util/memory/alloc.h2
-rw-r--r--util/memory/blob.cpp42
-rw-r--r--util/memory/blob.h50
-rw-r--r--util/memory/pool.cpp4
-rw-r--r--util/memory/pool.h56
-rw-r--r--util/memory/pool_ut.cpp6
-rw-r--r--util/memory/segmented_string_pool.h2
-rw-r--r--util/memory/segpool_alloc.h4
-rw-r--r--util/memory/smallobj.h18
-rw-r--r--util/memory/smallobj_ut.cpp2
-rw-r--r--util/memory/tempbuf.cpp72
-rw-r--r--util/memory/tempbuf.h28
-rw-r--r--util/memory/tempbuf_ut.cpp2
15 files changed, 152 insertions, 152 deletions
diff --git a/util/memory/addstorage.h b/util/memory/addstorage.h
index 53b12c68bd..597c73a988 100644
--- a/util/memory/addstorage.h
+++ b/util/memory/addstorage.h
@@ -41,15 +41,15 @@ public:
return data;
}
- inline void operator delete(void* ptr) noexcept {
+ inline void operator delete(void* ptr) noexcept {
DoDelete(ptr);
}
- inline void operator delete(void* ptr, size_t) noexcept {
+ inline void operator delete(void* ptr, size_t) noexcept {
DoDelete(ptr);
}
- inline void operator delete(void* ptr, size_t, size_t) noexcept {
+ inline void operator delete(void* ptr, size_t, size_t) noexcept {
/*
* this delete operator can be called automagically by compiler
*/
@@ -57,20 +57,20 @@ public:
DoDelete(ptr);
}
- inline void* AdditionalData() const noexcept {
+ inline void* AdditionalData() const noexcept {
return (char*)(static_cast<const T*>(this)) + CombinedSizeOfInstanceWithTInfo();
}
- static inline T* ObjectFromData(void* data) noexcept {
+ static inline T* ObjectFromData(void* data) noexcept {
return reinterpret_cast<T*>(static_cast<char*>(data) - CombinedSizeOfInstanceWithTInfo());
}
- inline size_t AdditionalDataLength() const noexcept {
+ inline size_t AdditionalDataLength() const noexcept {
return InfoPtr(static_cast<const T*>(this))->Length();
}
private:
- static inline void DoDelete(void* ptr) noexcept {
+ static inline void DoDelete(void* ptr) noexcept {
TInfo* info = InfoPtr(static_cast<T*>(ptr));
info->~TInfo();
::operator delete(ptr);
diff --git a/util/memory/alloc.cpp b/util/memory/alloc.cpp
index 0ce76855e1..49f012d857 100644
--- a/util/memory/alloc.cpp
+++ b/util/memory/alloc.cpp
@@ -15,6 +15,6 @@ void TDefaultAllocator::Release(const TBlock& block) {
y_deallocate(block.Data);
}
-IAllocator* TDefaultAllocator::Instance() noexcept {
+IAllocator* TDefaultAllocator::Instance() noexcept {
return SingletonWithPriority<TDefaultAllocator, 0>();
}
diff --git a/util/memory/alloc.h b/util/memory/alloc.h
index bb51a1a6a6..d59575aef5 100644
--- a/util/memory/alloc.h
+++ b/util/memory/alloc.h
@@ -23,5 +23,5 @@ public:
TBlock Allocate(size_t len) override;
void Release(const TBlock& block) override;
- static IAllocator* Instance() noexcept;
+ static IAllocator* Instance() noexcept;
};
diff --git a/util/memory/blob.cpp b/util/memory/blob.cpp
index 40b0cab8f4..91da5cadca 100644
--- a/util/memory/blob.cpp
+++ b/util/memory/blob.cpp
@@ -6,7 +6,7 @@
#include <util/system/mlock.h>
#include <util/stream/buffer.h>
#include <util/generic/ptr.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/buffer.h>
#include <util/generic/ylimits.h>
#include <util/generic/singleton.h>
@@ -23,19 +23,19 @@ public:
~TDynamicBlobBase() override = default;
- void Ref() noexcept override {
+ void Ref() noexcept override {
TRefBase::Ref();
}
- void UnRef() noexcept override {
+ void UnRef() noexcept override {
TRefBase::UnRef();
}
- inline void* Data() const noexcept {
+ inline void* Data() const noexcept {
return this->AdditionalData();
}
- inline size_t Length() const noexcept {
+ inline size_t Length() const noexcept {
return this->AdditionalDataLength();
}
};
@@ -51,15 +51,15 @@ public:
~TBufferBlobBase() override = default;
- void Ref() noexcept override {
+ void Ref() noexcept override {
TRefBase::Ref();
}
- void UnRef() noexcept override {
+ void UnRef() noexcept override {
TRefBase::UnRef();
}
- inline const TBuffer& Buffer() const noexcept {
+ inline const TBuffer& Buffer() const noexcept {
return Buf_;
}
@@ -72,7 +72,7 @@ class TStringBlobBase: public TBlob::TBase, public TRefCounted<TStringBlobBase<T
using TRefBase = TRefCounted<TStringBlobBase, TCounter>;
public:
- inline TStringBlobBase(const TString& s)
+ inline TStringBlobBase(const TString& s)
: S_(s)
{
}
@@ -84,20 +84,20 @@ public:
~TStringBlobBase() override = default;
- void Ref() noexcept override {
+ void Ref() noexcept override {
TRefBase::Ref();
}
- void UnRef() noexcept override {
+ void UnRef() noexcept override {
TRefBase::UnRef();
}
- inline const TString& String() const noexcept {
+ inline const TString& String() const noexcept {
return S_;
}
private:
- const TString S_;
+ const TString S_;
};
template <class TCounter>
@@ -128,19 +128,19 @@ public:
}
}
- void Ref() noexcept override {
+ void Ref() noexcept override {
TRefBase::Ref();
}
- void UnRef() noexcept override {
+ void UnRef() noexcept override {
TRefBase::UnRef();
}
- inline const void* Data() const noexcept {
+ inline const void* Data() const noexcept {
return Map_.Ptr();
}
- inline size_t Length() const noexcept {
+ inline size_t Length() const noexcept {
return Map_.MappedSize();
}
@@ -324,12 +324,12 @@ static inline TBlob ConstructFromFileContent(const TFile& file, ui64 offset, ui6
return ReadFromFile<TCounter>(file, offset, static_cast<size_t>(length));
}
-TBlob TBlob::FromFileContentSingleThreaded(const TString& path) {
+TBlob TBlob::FromFileContentSingleThreaded(const TString& path) {
TFile file(path, RdOnly);
return ConstructFromFileContent<TSimpleCounter>(file, 0, file.GetLength());
}
-TBlob TBlob::FromFileContent(const TString& path) {
+TBlob TBlob::FromFileContent(const TString& path) {
TFile file(path, RdOnly);
return ConstructFromFileContent<TAtomicCounter>(file, 0, file.GetLength());
}
@@ -401,7 +401,7 @@ TBlob ConstructFromString(S&& s) {
return ret;
}
-TBlob TBlob::FromStringSingleThreaded(const TString& s) {
+TBlob TBlob::FromStringSingleThreaded(const TString& s) {
return ConstructFromString<TSimpleCounter>(s);
}
@@ -409,7 +409,7 @@ TBlob TBlob::FromStringSingleThreaded(TString&& s) {
return ConstructFromString<TSimpleCounter>(std::move(s));
}
-TBlob TBlob::FromString(const TString& s) {
+TBlob TBlob::FromString(const TString& s) {
return ConstructFromString<TAtomicCounter>(s);
}
diff --git a/util/memory/blob.h b/util/memory/blob.h
index 46a82d5195..20c02a68df 100644
--- a/util/memory/blob.h
+++ b/util/memory/blob.h
@@ -28,8 +28,8 @@ public:
inline TBase() noexcept = default;
virtual ~TBase() = default;
- virtual void Ref() noexcept = 0;
- virtual void UnRef() noexcept = 0;
+ virtual void Ref() noexcept = 0;
+ virtual void UnRef() noexcept = 0;
};
private:
@@ -38,7 +38,7 @@ private:
size_t Length;
TBase* Base;
- inline TStorage(const void* data, size_t length, TBase* base) noexcept
+ inline TStorage(const void* data, size_t length, TBase* base) noexcept
: Data(data)
, Length(length)
, Base(base)
@@ -47,7 +47,7 @@ private:
inline ~TStorage() = default;
- inline void Swap(TStorage& r) noexcept {
+ inline void Swap(TStorage& r) noexcept {
DoSwap(Data, r.Data);
DoSwap(Length, r.Length);
DoSwap(Base, r.Base);
@@ -68,7 +68,7 @@ public:
{
}
- inline TBlob(const TBlob& r) noexcept
+ inline TBlob(const TBlob& r) noexcept
: S_(r.S_)
{
Ref();
@@ -80,34 +80,34 @@ public:
this->Swap(r);
}
- inline TBlob(const void* data, size_t length, TBase* base) noexcept
+ inline TBlob(const void* data, size_t length, TBase* base) noexcept
: S_(data, length, base)
{
Ref();
}
- inline ~TBlob() {
+ inline ~TBlob() {
UnRef();
}
- inline TBlob& operator=(const TBlob& r) noexcept {
+ inline TBlob& operator=(const TBlob& r) noexcept {
TBlob(r).Swap(*this);
return *this;
}
/// Swaps content of two data arrays.
- inline void Swap(TBlob& r) noexcept {
+ inline void Swap(TBlob& r) noexcept {
S_.Swap(r.S_);
}
/// Returns a const reference to the data array.
- inline const void* Data() const noexcept {
+ inline const void* Data() const noexcept {
return S_.Data;
}
/// Returns the size of the data array in bytes.
- inline size_t Length() const noexcept {
+ inline size_t Length() const noexcept {
return S_.Length;
}
@@ -122,17 +122,17 @@ public:
}
/// Checks if the object has a data array.
- inline bool IsNull() const noexcept {
+ inline bool IsNull() const noexcept {
return !Data();
}
/// Returns a const pointer of char type to the data array.
- inline const char* AsCharPtr() const noexcept {
+ inline const char* AsCharPtr() const noexcept {
return (const char*)Data();
}
/// Returns a const pointer of unsigned char type to the data array.
- inline const unsigned char* AsUnsignedCharPtr() const noexcept {
+ inline const unsigned char* AsUnsignedCharPtr() const noexcept {
return (const unsigned char*)Data();
}
@@ -141,7 +141,7 @@ public:
}
/// Drops the data array.
- inline void Drop() noexcept {
+ inline void Drop() noexcept {
TBlob().Swap(*this);
}
@@ -163,21 +163,21 @@ public:
}
/// Returns the size of the data array in bytes.
- inline size_t Size() const noexcept {
+ inline size_t Size() const noexcept {
return Length();
}
/// Standard iterator.
- inline const_iterator Begin() const noexcept {
+ inline const_iterator Begin() const noexcept {
return AsUnsignedCharPtr();
}
/// Standard iterator.
- inline const_iterator End() const noexcept {
+ inline const_iterator End() const noexcept {
return Begin() + Size();
}
- inline value_type operator[](size_t n) const noexcept {
+ inline value_type operator[](size_t n) const noexcept {
return *(Begin() + n);
}
@@ -263,10 +263,10 @@ public:
static TBlob FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length);
/// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread().
- static TBlob FromFileContentSingleThreaded(const TString& path);
+ static TBlob FromFileContentSingleThreaded(const TString& path);
/// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread().
- static TBlob FromFileContent(const TString& path);
+ static TBlob FromFileContent(const TString& path);
/// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file using pread().
static TBlob FromFileContentSingleThreaded(const TFile& file);
@@ -295,25 +295,25 @@ public:
static TBlob FromBuffer(TBuffer& in);
/// Creates a blob from TString with a single-threaded (non atomic) refcounter.
- static TBlob FromStringSingleThreaded(const TString& s);
+ static TBlob FromStringSingleThreaded(const TString& s);
/// Creates a blob from TString with a single-threaded (non atomic) refcounter. Doesn't copy its content.
static TBlob FromStringSingleThreaded(TString&& s);
/// Creates a blob from TString with a multi-threaded (atomic) refcounter.
- static TBlob FromString(const TString& s);
+ static TBlob FromString(const TString& s);
/// Creates a blob from TString with a multi-threaded (atomic) refcounter. Doesn't copy its content.
static TBlob FromString(TString&& s);
private:
- inline void Ref() noexcept {
+ inline void Ref() noexcept {
if (S_.Base) {
S_.Base->Ref();
}
}
- inline void UnRef() noexcept {
+ inline void UnRef() noexcept {
if (S_.Base) {
S_.Base->UnRef();
}
diff --git a/util/memory/pool.cpp b/util/memory/pool.cpp
index 4addca2fe6..9a011f0e4f 100644
--- a/util/memory/pool.cpp
+++ b/util/memory/pool.cpp
@@ -1,11 +1,11 @@
#include "pool.h"
-TMemoryPool::IGrowPolicy* TMemoryPool::TLinearGrow::Instance() noexcept {
+TMemoryPool::IGrowPolicy* TMemoryPool::TLinearGrow::Instance() noexcept {
return SingletonWithPriority<TLinearGrow, 0>();
}
-TMemoryPool::IGrowPolicy* TMemoryPool::TExpGrow::Instance() noexcept {
+TMemoryPool::IGrowPolicy* TMemoryPool::TExpGrow::Instance() noexcept {
return SingletonWithPriority<TExpGrow, 0>();
}
diff --git a/util/memory/pool.h b/util/memory/pool.h
index 7fe26e8120..13c8b6b9ed 100644
--- a/util/memory/pool.h
+++ b/util/memory/pool.h
@@ -29,14 +29,14 @@ private:
class TChunk: public TIntrusiveListItem<TChunk> {
public:
- inline TChunk(size_t len = 0) noexcept
+ inline TChunk(size_t len = 0) noexcept
: Cur_((char*)(this + 1))
, Left_(len)
{
Y_ASSERT((((size_t)Cur_) % PLATFORM_DATA_ALIGN) == 0);
}
- inline void* Allocate(size_t len) noexcept {
+ inline void* Allocate(size_t len) noexcept {
if (Left_ >= len) {
char* ret = Cur_;
@@ -49,7 +49,7 @@ private:
return nullptr;
}
- inline void* Allocate(size_t len, size_t align) noexcept {
+ inline void* Allocate(size_t len, size_t align) noexcept {
size_t pad = AlignUp(Cur_, align) - Cur_;
void* ret = Allocate(pad + len);
@@ -60,31 +60,31 @@ private:
return nullptr;
}
- inline size_t BlockLength() const noexcept {
+ inline size_t BlockLength() const noexcept {
return (Cur_ + Left_) - (char*)this;
}
- inline size_t Used() const noexcept {
+ inline size_t Used() const noexcept {
return Cur_ - (const char*)this;
}
- inline size_t Left() const noexcept {
+ inline size_t Left() const noexcept {
return Left_;
}
- inline const char* Data() const noexcept {
+ inline const char* Data() const noexcept {
return (const char*)(this + 1);
}
- inline char* Data() noexcept {
+ inline char* Data() noexcept {
return (char*)(this + 1);
}
- inline size_t DataSize() const noexcept {
+ inline size_t DataSize() const noexcept {
return Cur_ - Data();
}
- inline void ResetChunk() noexcept {
+ inline void ResetChunk() noexcept {
size_t total = DataSize() + Left();
Cur_ = Data();
Left_ = total;
@@ -102,25 +102,25 @@ public:
public:
virtual ~IGrowPolicy() = default;
- virtual size_t Next(size_t prev) const noexcept = 0;
+ virtual size_t Next(size_t prev) const noexcept = 0;
};
class TLinearGrow: public IGrowPolicy {
public:
- size_t Next(size_t prev) const noexcept override {
+ size_t Next(size_t prev) const noexcept override {
return prev;
}
- static IGrowPolicy* Instance() noexcept;
+ static IGrowPolicy* Instance() noexcept;
};
class TExpGrow: public IGrowPolicy {
public:
- size_t Next(size_t prev) const noexcept override {
+ size_t Next(size_t prev) const noexcept override {
return prev * 2;
}
- static IGrowPolicy* Instance() noexcept;
+ static IGrowPolicy* Instance() noexcept;
};
struct TOptions {
@@ -143,7 +143,7 @@ public:
{
}
- inline ~TMemoryPool() {
+ inline ~TMemoryPool() {
Clear();
}
@@ -232,28 +232,28 @@ public:
return TBasicStringBuf<TChar>(ret, buf.size());
}
- inline size_t Available() const noexcept {
+ inline size_t Available() const noexcept {
return Current_->Left();
}
- inline void Clear() noexcept {
+ inline void Clear() noexcept {
DoClear(false);
}
- inline void ClearKeepFirstChunk() noexcept {
+ inline void ClearKeepFirstChunk() noexcept {
DoClear(true);
}
- inline size_t MemoryAllocated() const noexcept {
+ inline size_t MemoryAllocated() const noexcept {
return MemoryAllocatedBeforeCurrent_ + (Current_ != &Empty_ ? Current_->Used() : 0);
}
- inline size_t MemoryWaste() const noexcept {
+ inline size_t MemoryWaste() const noexcept {
return MemoryWasteBeforeCurrent_ + (Current_ != &Empty_ ? Current_->Left() : 0);
}
template <class TOp>
- inline void Traverse(TOp& op) const noexcept {
+ inline void Traverse(TOp& op) const noexcept {
for (TChunkList::TConstIterator i = Chunks_.Begin(); i != Chunks_.End(); ++i) {
op(i->Data(), i->DataSize());
}
@@ -316,10 +316,10 @@ struct TPoolableBase {
return pool.Allocate(bytes, (size_t)align);
}
- inline void operator delete(void*, size_t) noexcept {
+ inline void operator delete(void*, size_t) noexcept {
}
- inline void operator delete(void*, TPool&) noexcept {
+ inline void operator delete(void*, TPool&) noexcept {
}
private:
@@ -384,7 +384,7 @@ public:
using other = TPoolAllocBase<T1, TPool>;
};
- inline size_type max_size() const noexcept {
+ inline size_type max_size() const noexcept {
return size_type(-1) / sizeof(T);
}
@@ -393,7 +393,7 @@ public:
new (p) T(std::forward<Args>(args)...);
}
- inline void destroy(pointer p) noexcept {
+ inline void destroy(pointer p) noexcept {
(void)p; /* Make MSVC happy. */
p->~T();
}
@@ -421,11 +421,11 @@ using TPoolAlloc = TPoolAllocBase<T, TMemoryPool>;
using TPoolAllocator = TPoolAlloc<int>;
template <class T>
-inline bool operator==(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept {
+inline bool operator==(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept {
return true;
}
template <class T>
-inline bool operator!=(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept {
+inline bool operator!=(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept {
return false;
}
diff --git a/util/memory/pool_ut.cpp b/util/memory/pool_ut.cpp
index 88812b2310..1158a8ca42 100644
--- a/util/memory/pool_ut.cpp
+++ b/util/memory/pool_ut.cpp
@@ -146,11 +146,11 @@ private:
: ConstructorType(2)
{
}
- TConstructorTest(const TString&, const TString&)
+ TConstructorTest(const TString&, const TString&)
: ConstructorType(3)
{
}
- TConstructorTest(TString&&, TString&&)
+ TConstructorTest(TString&&, TString&&)
: ConstructorType(4)
{
}
@@ -228,7 +228,7 @@ private:
void CheckMoveAlloc() {
TMemoryPool pool(10 * sizeof(T));
- TVector<T, TPoolAllocator> elems(&pool);
+ TVector<T, TPoolAllocator> elems(&pool);
elems.reserve(1);
elems.emplace_back();
elems.resize(100);
diff --git a/util/memory/segmented_string_pool.h b/util/memory/segmented_string_pool.h
index 1bd06d8dc7..a40aa408f5 100644
--- a/util/memory/segmented_string_pool.h
+++ b/util/memory/segmented_string_pool.h
@@ -35,7 +35,7 @@ protected:
{
}
};
- using seg_container = TVector<seg_inf>;
+ using seg_container = TVector<seg_inf>;
using seg_iterator = typename seg_container::iterator;
using seg_const_iterator = typename seg_container::const_iterator;
const size_t segment_size; // default size of a memory chunk in sizeof(T)-units
diff --git a/util/memory/segpool_alloc.h b/util/memory/segpool_alloc.h
index d2a08055a7..1a83b7a543 100644
--- a/util/memory/segpool_alloc.h
+++ b/util/memory/segpool_alloc.h
@@ -15,7 +15,7 @@
Use segpool_alloc_vt as allocator template parameter for container.
Example:
- using TSomething = THashMap<A, B, hash<A>, TEqualTo<A>, segpool_alloc_vt>;
+ using TSomething = THashMap<A, B, hash<A>, TEqualTo<A>, segpool_alloc_vt>;
...
TSomething something;
something.GetNodeAllocator().pool = &alloc_pool;
@@ -25,7 +25,7 @@
hack them, or fix segpool_alloc so that it would create ref-counted
segmented_pool object on it's own
- ! Only tested with THashMap
+ ! Only tested with THashMap
*/
template <class _Tp>
diff --git a/util/memory/smallobj.h b/util/memory/smallobj.h
index e4d71ddb4f..63de666bae 100644
--- a/util/memory/smallobj.h
+++ b/util/memory/smallobj.h
@@ -8,11 +8,11 @@
class TFixedSizeAllocator {
struct TAlloc: public TIntrusiveSListItem<TAlloc> {
- inline void* ToPointer() noexcept {
+ inline void* ToPointer() noexcept {
return this;
}
- static inline TAlloc* FromPointer(void* ptr) noexcept {
+ static inline TAlloc* FromPointer(void* ptr) noexcept {
return (TAlloc*)ptr;
}
@@ -24,7 +24,7 @@ class TFixedSizeAllocator {
return Max(alignof(TAlloc), align);
}
- static inline TAlloc* Construct(void* ptr) noexcept {
+ static inline TAlloc* Construct(void* ptr) noexcept {
return (TAlloc*)ptr;
}
};
@@ -62,11 +62,11 @@ public:
return Free_.PopFront()->ToPointer();
}
- inline void Release(void* ptr) noexcept {
+ inline void Release(void* ptr) noexcept {
Free_.PushFront(TAlloc::FromPointer(ptr));
}
- inline size_t Size() const noexcept {
+ inline size_t Size() const noexcept {
return AllocSize_;
}
@@ -96,7 +96,7 @@ public:
return (T*)Alloc_.Allocate();
}
- inline void Release(T* t) noexcept {
+ inline void Release(T* t) noexcept {
Alloc_.Release(t);
}
@@ -120,11 +120,11 @@ public:
return &ret->Obj;
}
- inline void operator delete(void* ptr, size_t) noexcept {
+ inline void operator delete(void* ptr, size_t) noexcept {
DoDelete(ptr);
}
- inline void operator delete(void* ptr, TPool*) noexcept {
+ inline void operator delete(void* ptr, TPool*) noexcept {
/*
* this delete operator can be called automagically by compiler
*/
@@ -133,7 +133,7 @@ public:
}
private:
- static inline void DoDelete(void* ptr) noexcept {
+ 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);
diff --git a/util/memory/smallobj_ut.cpp b/util/memory/smallobj_ut.cpp
index 78435de9bb..86003d1d53 100644
--- a/util/memory/smallobj_ut.cpp
+++ b/util/memory/smallobj_ut.cpp
@@ -61,7 +61,7 @@ private:
inline void TestAllocate() {
TClass::TPool pool(TDefaultAllocator::Instance());
- THashSet<TClass*> alloced;
+ THashSet<TClass*> alloced;
for (size_t i = 0; i < 10000; ++i) {
TClass* c = new (&pool) TClass;
diff --git a/util/memory/tempbuf.cpp b/util/memory/tempbuf.cpp
index f21b1bbc06..09a2d0f140 100644
--- a/util/memory/tempbuf.cpp
+++ b/util/memory/tempbuf.cpp
@@ -16,7 +16,7 @@
class TTempBuf::TImpl: public TRefCounted<TImpl, TSimpleCounter, TImpl> {
public:
- inline TImpl(void* data, size_t size) noexcept
+ inline TImpl(void* data, size_t size) noexcept
: Data_(data)
, Size_(size)
, Offset_(0)
@@ -29,27 +29,27 @@ public:
*/
virtual ~TImpl() = default;
- inline void* Data() noexcept {
+ inline void* Data() noexcept {
return Data_;
}
- const void* Data() const noexcept {
+ const void* Data() const noexcept {
return Data_;
}
- inline size_t Size() const noexcept {
+ inline size_t Size() const noexcept {
return Size_;
}
- inline size_t Filled() const noexcept {
+ inline size_t Filled() const noexcept {
return Offset_;
}
- inline void Reset() noexcept {
+ inline void Reset() noexcept {
Offset_ = 0;
}
- inline size_t Left() const noexcept {
+ inline size_t Left() const noexcept {
return Size() - Filled();
}
@@ -64,12 +64,12 @@ public:
Offset_ += off;
}
- static inline void Destroy(TImpl* This) noexcept {
+ static inline void Destroy(TImpl* This) noexcept {
This->Dispose();
}
protected:
- virtual void Dispose() noexcept = 0;
+ virtual void Dispose() noexcept = 0;
private:
void* Data_;
@@ -90,7 +90,7 @@ namespace {
inline ~TAllocedBuf() override = default;
private:
- void Dispose() noexcept override {
+ void Dispose() noexcept override {
delete this;
}
};
@@ -99,7 +99,7 @@ namespace {
friend class TTempBufManager;
public:
- inline TPerThreadedBuf(TTempBufManager* manager) noexcept
+ inline TPerThreadedBuf(TTempBufManager* manager) noexcept
: TImpl(Data_, sizeof(Data_))
, Manager_(manager)
{
@@ -108,7 +108,7 @@ namespace {
inline ~TPerThreadedBuf() override = default;
private:
- void Dispose() noexcept override;
+ void Dispose() noexcept override;
private:
char Data_[TMP_BUF_LEN];
@@ -117,16 +117,16 @@ namespace {
class TTempBufManager {
struct TDelete {
- inline void operator()(TPerThreadedBuf* p) noexcept {
+ inline void operator()(TPerThreadedBuf* p) noexcept {
delete p;
}
};
public:
- inline TTempBufManager() noexcept {
+ inline TTempBufManager() noexcept {
}
- inline ~TTempBufManager() {
+ inline ~TTempBufManager() {
TDelete deleter;
Unused_.ForEach(deleter);
@@ -140,7 +140,7 @@ namespace {
return new TPerThreadedBuf(this);
}
- inline void Return(TPerThreadedBuf* buf) noexcept {
+ inline void Return(TPerThreadedBuf* buf) noexcept {
buf->Reset();
Unused_.PushFront(buf);
}
@@ -163,7 +163,7 @@ static inline TTempBuf::TImpl* AcquireSmallBuffer(size_t size) {
#endif
}
-void TPerThreadedBuf::Dispose() noexcept {
+void TPerThreadedBuf::Dispose() noexcept {
if (Manager_ == TempBufManager()) {
Manager_->Return(this);
} else {
@@ -196,14 +196,14 @@ TTempBuf::TTempBuf(size_t len)
TTempBuf::TTempBuf(const TTempBuf&) noexcept = default;
-TTempBuf::TTempBuf(TTempBuf&& b) noexcept
+TTempBuf::TTempBuf(TTempBuf&& b) noexcept
: Impl_(std::move(b.Impl_))
{
}
TTempBuf::~TTempBuf() = default;
-TTempBuf& TTempBuf::operator=(const TTempBuf& b) noexcept {
+TTempBuf& TTempBuf::operator=(const TTempBuf& b) noexcept {
if (this != &b) {
Impl_ = b.Impl_;
}
@@ -211,43 +211,43 @@ TTempBuf& TTempBuf::operator=(const TTempBuf& b) noexcept {
return *this;
}
-TTempBuf& TTempBuf::operator=(TTempBuf&& b) noexcept {
- if (this != &b) {
- Impl_ = std::move(b.Impl_);
- }
-
- return *this;
-}
-
-char* TTempBuf::Data() noexcept {
+TTempBuf& TTempBuf::operator=(TTempBuf&& b) noexcept {
+ if (this != &b) {
+ Impl_ = std::move(b.Impl_);
+ }
+
+ return *this;
+}
+
+char* TTempBuf::Data() noexcept {
return (char*)Impl_->Data();
}
-const char* TTempBuf::Data() const noexcept {
+const char* TTempBuf::Data() const noexcept {
return static_cast<const char*>(Impl_->Data());
}
-size_t TTempBuf::Size() const noexcept {
+size_t TTempBuf::Size() const noexcept {
return Impl_->Size();
}
-char* TTempBuf::Current() noexcept {
+char* TTempBuf::Current() noexcept {
return Data() + Filled();
}
-const char* TTempBuf::Current() const noexcept {
+const char* TTempBuf::Current() const noexcept {
return Data() + Filled();
}
-size_t TTempBuf::Filled() const noexcept {
+size_t TTempBuf::Filled() const noexcept {
return Impl_->Filled();
}
-size_t TTempBuf::Left() const noexcept {
+size_t TTempBuf::Left() const noexcept {
return Impl_->Left();
}
-void TTempBuf::Reset() noexcept {
+void TTempBuf::Reset() noexcept {
Impl_->Reset();
}
@@ -270,7 +270,7 @@ void TTempBuf::Append(const void* data, size_t len) {
Proceed(len);
}
-bool TTempBuf::IsNull() const noexcept {
+bool TTempBuf::IsNull() const noexcept {
return !Impl_;
}
diff --git a/util/memory/tempbuf.h b/util/memory/tempbuf.h
index 15a475680e..334670eb1e 100644
--- a/util/memory/tempbuf.h
+++ b/util/memory/tempbuf.h
@@ -18,12 +18,12 @@ public:
TTempBuf();
TTempBuf(size_t len);
- TTempBuf(const TTempBuf& b) noexcept;
- TTempBuf(TTempBuf&& b) noexcept;
- ~TTempBuf();
+ TTempBuf(const TTempBuf& b) noexcept;
+ TTempBuf(TTempBuf&& b) noexcept;
+ ~TTempBuf();
- TTempBuf& operator=(const TTempBuf& b) noexcept;
- TTempBuf& operator=(TTempBuf&& b) noexcept;
+ TTempBuf& operator=(const TTempBuf& b) noexcept;
+ TTempBuf& operator=(TTempBuf&& b) noexcept;
Y_PURE_FUNCTION char* Data() noexcept;
@@ -39,7 +39,7 @@ public:
Y_PURE_FUNCTION size_t Left() const noexcept;
- void Reset() noexcept;
+ void Reset() noexcept;
void SetPos(size_t off);
char* Proceed(size_t off);
void Append(const void* data, size_t len);
@@ -53,10 +53,10 @@ private:
template <typename T>
class TTempArray: private TTempBuf {
private:
- static T* TypedPointer(char* pointer) noexcept {
+ static T* TypedPointer(char* pointer) noexcept {
return reinterpret_cast<T*>(pointer);
}
- static const T* TypedPointer(const char* pointer) noexcept {
+ static const T* TypedPointer(const char* pointer) noexcept {
return reinterpret_cast<const T*>(pointer);
}
static constexpr size_t RawSize(const size_t size) noexcept {
@@ -74,26 +74,26 @@ public:
{
}
- T* Data() noexcept {
+ T* Data() noexcept {
return TypedPointer(TTempBuf::Data());
}
- const T* Data() const noexcept {
+ const T* Data() const noexcept {
return TypedPointer(TTempBuf::Data());
}
- T* Current() noexcept {
+ T* Current() noexcept {
return TypedPointer(TTempBuf::Current());
}
- const T* Current() const noexcept {
+ const T* Current() const noexcept {
return TypedPointer(TTempBuf::Current());
}
- size_t Size() const noexcept {
+ size_t Size() const noexcept {
return TypedSize(TTempBuf::Size());
}
- size_t Filled() const noexcept {
+ size_t Filled() const noexcept {
return TypedSize(TTempBuf::Filled());
}
diff --git a/util/memory/tempbuf_ut.cpp b/util/memory/tempbuf_ut.cpp
index 8cb5fa86b7..d6bcf9d546 100644
--- a/util/memory/tempbuf_ut.cpp
+++ b/util/memory/tempbuf_ut.cpp
@@ -27,7 +27,7 @@ public:
tmp.Append("def", 3);
UNIT_ASSERT_EQUAL(tmp.Filled(), 6);
- UNIT_ASSERT_EQUAL(TString(tmp.Data(), tmp.Filled()), "abcdef");
+ UNIT_ASSERT_EQUAL(TString(tmp.Data(), tmp.Filled()), "abcdef");
}
};