diff options
author | iddqd <iddqd@yandex-team.ru> | 2022-02-10 16:49:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:45 +0300 |
commit | 07fce9c5f7771600d0b3d70e1f88fd8a7e164d85 (patch) | |
tree | e4aa4750fbb864d70f8c06cf03d2750e979ea3bf /library/cpp/lfalloc | |
parent | af42068bf6cd93c976b80dd0388fa48cdf65da11 (diff) | |
download | ydb-07fce9c5f7771600d0b3d70e1f88fd8a7e164d85.tar.gz |
Restoring authorship annotation for <iddqd@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/lfalloc')
-rw-r--r-- | library/cpp/lfalloc/lf_allocX64.cpp | 52 | ||||
-rw-r--r-- | library/cpp/lfalloc/lf_allocX64.h | 16 |
2 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/lfalloc/lf_allocX64.cpp b/library/cpp/lfalloc/lf_allocX64.cpp index 2eb90761fe..e3dcac8e96 100644 --- a/library/cpp/lfalloc/lf_allocX64.cpp +++ b/library/cpp/lfalloc/lf_allocX64.cpp @@ -1,4 +1,4 @@ -#include "lf_allocX64.h" +#include "lf_allocX64.h" ////////////////////////////////////////////////////////////////////////// // hooks @@ -8,14 +8,14 @@ #define OP_THROWNOTHING #endif -#ifndef _darwin_ +#ifndef _darwin_ #if !defined(YMAKE) void* operator new(size_t size) { - return LFAlloc(size); + return LFAlloc(size); } void* operator new(size_t size, const std::nothrow_t&) OP_THROWNOTHING { - return LFAlloc(size); + return LFAlloc(size); } void operator delete(void* p)OP_THROWNOTHING { @@ -27,11 +27,11 @@ void operator delete(void* p, const std::nothrow_t&)OP_THROWNOTHING { } void* operator new[](size_t size) { - return LFAlloc(size); + return LFAlloc(size); } void* operator new[](size_t size, const std::nothrow_t&) OP_THROWNOTHING { - return LFAlloc(size); + return LFAlloc(size); } void operator delete[](void* p) OP_THROWNOTHING { @@ -46,20 +46,20 @@ void operator delete[](void* p, const std::nothrow_t&) OP_THROWNOTHING { //#ifndef _MSC_VER extern "C" void* malloc(size_t size) { - return LFAlloc(size); + return LFAlloc(size); } extern "C" void* valloc(size_t size) { - return LFVAlloc(size); + return LFVAlloc(size); } extern "C" int posix_memalign(void** memptr, size_t alignment, size_t size) { - return LFPosixMemalign(memptr, alignment, size); + return LFPosixMemalign(memptr, alignment, size); } extern "C" void* memalign(size_t alignment, size_t size) { void* ptr; - int res = LFPosixMemalign(&ptr, alignment, size); + int res = LFPosixMemalign(&ptr, alignment, size); return res ? nullptr : ptr; } @@ -84,7 +84,7 @@ extern "C" void* calloc(size_t n, size_t elem_size) { if (elem_size != 0 && size / elem_size != n) return nullptr; - void* result = LFAlloc(size); + void* result = LFAlloc(size); if (result != nullptr) { memset(result, 0, size); } @@ -97,7 +97,7 @@ extern "C" void cfree(void* ptr) { extern "C" void* realloc(void* old_ptr, size_t new_size) { if (old_ptr == nullptr) { - void* result = LFAlloc(new_size); + void* result = LFAlloc(new_size); return result; } if (new_size == 0) { @@ -105,7 +105,7 @@ extern "C" void* realloc(void* old_ptr, size_t new_size) { return nullptr; } - void* new_ptr = LFAlloc(new_size); + void* new_ptr = LFAlloc(new_size); if (new_ptr == nullptr) { return nullptr; } @@ -122,20 +122,20 @@ extern "C" size_t malloc_usable_size(void* ptr) { return LFGetSize(ptr); } -NMalloc::TMallocInfo NMalloc::MallocInfo() { - NMalloc::TMallocInfo r; -#if defined(LFALLOC_DBG) - r.Name = "lfalloc_dbg"; -#elif defined(LFALLOC_YT) - r.Name = "lfalloc_yt"; -#else - r.Name = "lfalloc"; -#endif - r.SetParam = &LFAlloc_SetParam; - r.GetParam = &LFAlloc_GetParam; - return r; -} +NMalloc::TMallocInfo NMalloc::MallocInfo() { + NMalloc::TMallocInfo r; +#if defined(LFALLOC_DBG) + r.Name = "lfalloc_dbg"; +#elif defined(LFALLOC_YT) + r.Name = "lfalloc_yt"; #else + r.Name = "lfalloc"; +#endif + r.SetParam = &LFAlloc_SetParam; + r.GetParam = &LFAlloc_GetParam; + return r; +} +#else NMalloc::TMallocInfo NMalloc::MallocInfo() { NMalloc::TMallocInfo r; r.Name = "system-darwin"; diff --git a/library/cpp/lfalloc/lf_allocX64.h b/library/cpp/lfalloc/lf_allocX64.h index fd2a906d6f..6b13d74102 100644 --- a/library/cpp/lfalloc/lf_allocX64.h +++ b/library/cpp/lfalloc/lf_allocX64.h @@ -1,5 +1,5 @@ -#pragma once - +#pragma once + #include <stdlib.h> #include <stdio.h> #include <stdarg.h> @@ -1504,7 +1504,7 @@ extern "C" void GetPerTagAllocInfo( #endif // LFALLOC_DBG ////////////////////////////////////////////////////////////////////////// -static Y_FORCE_INLINE void* LFAllocImpl(size_t _nSize) { +static Y_FORCE_INLINE void* LFAllocImpl(size_t _nSize) { #if defined(LFALLOC_DBG) size_t size = _nSize; _nSize += sizeof(TAllocHeader); @@ -1571,13 +1571,13 @@ static Y_FORCE_INLINE void* LFAllocImpl(size_t _nSize) { } } -static Y_FORCE_INLINE void* LFAlloc(size_t _nSize) { - void* res = LFAllocImpl(_nSize); +static Y_FORCE_INLINE void* LFAlloc(size_t _nSize) { + void* res = LFAllocImpl(_nSize); #ifdef DBG_FILL_MEMORY if (FillMemoryOnAllocation && res && (_nSize <= DBG_FILL_MAX_SIZE)) { memset(res, 0xcf, _nSize); } -#endif +#endif return res; } @@ -1868,7 +1868,7 @@ static const char* LFAlloc_GetParam(const char* param) { return nullptr; } -static Y_FORCE_INLINE int LFPosixMemalign(void** memptr, size_t alignment, size_t size) { +static Y_FORCE_INLINE int LFPosixMemalign(void** memptr, size_t alignment, size_t size) { if (Y_UNLIKELY(alignment > 4096)) { const char* error = "Larger alignment are not guaranteed with this implementation\n"; #ifdef _win_ @@ -1888,7 +1888,7 @@ static Y_FORCE_INLINE int LFPosixMemalign(void** memptr, size_t alignment, size_ } #endif - *memptr = LFAlloc(bigsize); + *memptr = LFAlloc(bigsize); #if defined(LFALLOC_DBG) if (alignment > sizeof(TAllocHeader)) { |