diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
commit | baa58daefa91fde4b4769facdbd2903763b9c6a8 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/balloc | |
parent | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (diff) | |
download | ydb-baa58daefa91fde4b4769facdbd2903763b9c6a8.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/balloc')
-rw-r--r-- | library/cpp/balloc/balloc.cpp | 56 | ||||
-rw-r--r-- | library/cpp/balloc/optional/ya.make | 4 | ||||
-rw-r--r-- | library/cpp/balloc/ya.make | 8 |
3 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/balloc/balloc.cpp b/library/cpp/balloc/balloc.cpp index 5d1584273e..fab489db4c 100644 --- a/library/cpp/balloc/balloc.cpp +++ b/library/cpp/balloc/balloc.cpp @@ -13,24 +13,24 @@ namespace NBalloc { static Y_FORCE_INLINE void* Malloc(size_t size) { TLS& ltls = tls; - size = Align(size, sizeof(TAllocHeader)); + size = Align(size, sizeof(TAllocHeader)); if (Y_UNLIKELY(ltls.Mode == Empty || ltls.Mode == ToBeEnabled)) { - Init(ltls); + Init(ltls); } if (Y_LIKELY(ltls.Mode != Disabled)) { - TAllocHeader* allocHeader = AllocateRaw(size, ALIVE_SIGNATURE); - return allocHeader + 1; + TAllocHeader* allocHeader = AllocateRaw(size, ALIVE_SIGNATURE); + return allocHeader + 1; } else { // ltls.Mode == Disabled const size_t extsize = size + sizeof(TAllocHeader); - TAllocHeader* allocHeader = (TAllocHeader*)LibcMalloc(extsize); + TAllocHeader* allocHeader = (TAllocHeader*)LibcMalloc(extsize); allocHeader->Encode(allocHeader, size, DISABLED_SIGNATURE); - return allocHeader + 1; + return allocHeader + 1; } } static void Y_FORCE_INLINE Free(void* ptr) { - if (ptr == nullptr) { + if (ptr == nullptr) { return; } TAllocHeader* allocHeader = ((TAllocHeader*)ptr) - 1; @@ -38,9 +38,9 @@ namespace NBalloc { const size_t signature = size & SIGNATURE_MASK; if (Y_LIKELY(signature == ALIVE_SIGNATURE)) { allocHeader->AllocSize = 0; // abort later on double free -#ifdef DBG_FILL_MEMORY - memset(ptr, 0xde, size - signature); -#endif +#ifdef DBG_FILL_MEMORY + memset(ptr, 0xde, size - signature); +#endif FreeRaw(allocHeader->Block); if (NAllocStats::IsEnabled()) { NAllocStats::DecThreadAllocStats(size - signature); @@ -66,15 +66,15 @@ namespace NBalloc { } static void Y_FORCE_INLINE Disable() { -#if defined(_musl_) +#if defined(_musl_) // just skip it -#else +#else tls.Mode = Disabled; -#endif +#endif } static void Y_FORCE_INLINE Enable() { - tls.Mode = ToBeEnabled; + tls.Mode = ToBeEnabled; } static bool Y_FORCE_INLINE IsDisabled() { @@ -103,12 +103,12 @@ extern "C" void free(void* data) { #endif } -#if defined(USE_INTELCC) || defined(_darwin_) || defined(_freebsd_) || defined(_STLPORT_VERSION) -#define OP_THROWNOTHING noexcept -#else -#define OP_THROWNOTHING -#endif - +#if defined(USE_INTELCC) || defined(_darwin_) || defined(_freebsd_) || defined(_STLPORT_VERSION) +#define OP_THROWNOTHING noexcept +#else +#define OP_THROWNOTHING +#endif + void* operator new(size_t size) { #if defined(Y_COVER_PTR) return malloc(size); @@ -132,8 +132,8 @@ int posix_memalign(void** memptr, const size_t alignment, const size_t size) { } size_t bigSize = size + alignment - NBalloc::MINIMAL_ALIGNMENT; void* res = NBalloc::Malloc(bigSize); - void* alignedPtr = (void*)NBalloc::Align((size_t)res, alignment); - if (alignedPtr != res) { + void* alignedPtr = (void*)NBalloc::Align((size_t)res, alignment); + if (alignedPtr != res) { auto oldAllocHeader = (NBalloc::TAllocHeader*)res - 1; auto newAllocHeader = (NBalloc::TAllocHeader*)alignedPtr - 1; void* block = oldAllocHeader->Block; @@ -144,7 +144,7 @@ int posix_memalign(void** memptr, const size_t alignment, const size_t size) { #endif } -void* operator new(size_t size, const std::nothrow_t&) OP_THROWNOTHING { +void* operator new(size_t size, const std::nothrow_t&) OP_THROWNOTHING { #if defined(Y_COVER_PTR) return malloc(size); #else @@ -152,7 +152,7 @@ void* operator new(size_t size, const std::nothrow_t&) OP_THROWNOTHING { #endif } -void operator delete(void* p)OP_THROWNOTHING { +void operator delete(void* p)OP_THROWNOTHING { #if defined(Y_COVER_PTR) free(p); #else @@ -160,7 +160,7 @@ void operator delete(void* p)OP_THROWNOTHING { #endif } -void operator delete(void* p, const std::nothrow_t&)OP_THROWNOTHING { +void operator delete(void* p, const std::nothrow_t&)OP_THROWNOTHING { #if defined(Y_COVER_PTR) free(p); #else @@ -176,7 +176,7 @@ void* operator new[](size_t size) { #endif } -void* operator new[](size_t size, const std::nothrow_t&) OP_THROWNOTHING { +void* operator new[](size_t size, const std::nothrow_t&) OP_THROWNOTHING { #if defined(Y_COVER_PTR) return malloc(size); #else @@ -184,7 +184,7 @@ void* operator new[](size_t size, const std::nothrow_t&) OP_THROWNOTHING { #endif } -void operator delete[](void* p) OP_THROWNOTHING { +void operator delete[](void* p) OP_THROWNOTHING { #if defined(Y_COVER_PTR) free(p); #else @@ -192,7 +192,7 @@ void operator delete[](void* p) OP_THROWNOTHING { #endif } -void operator delete[](void* p, const std::nothrow_t&) OP_THROWNOTHING { +void operator delete[](void* p, const std::nothrow_t&) OP_THROWNOTHING { #if defined(Y_COVER_PTR) free(p); #else diff --git a/library/cpp/balloc/optional/ya.make b/library/cpp/balloc/optional/ya.make index 9993894b41..f740fc0b7d 100644 --- a/library/cpp/balloc/optional/ya.make +++ b/library/cpp/balloc/optional/ya.make @@ -11,5 +11,5 @@ PEERDIR( ) END() - -NEED_CHECK() + +NEED_CHECK() diff --git a/library/cpp/balloc/ya.make b/library/cpp/balloc/ya.make index 6080917c18..d4457fbba9 100644 --- a/library/cpp/balloc/ya.make +++ b/library/cpp/balloc/ya.make @@ -6,7 +6,7 @@ OWNER( ) NO_UTIL() -NO_COMPILER_WARNINGS() +NO_COMPILER_WARNINGS() IF (OS_WINDOWS) PEERDIR( @@ -17,12 +17,12 @@ ELSE() balloc.cpp malloc-info.cpp ) - + PEERDIR( library/cpp/balloc/lib ) ENDIF() END() - -NEED_CHECK() + +NEED_CHECK() |