aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorsandello <sandello@yandex-team.ru>2022-02-10 16:49:52 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:52 +0300
commit0cdbcf332f1f329f0a3d6759462ad71e7867ac08 (patch)
tree6866207854e212f8179cb77bd1e2435e49743f66 /library
parent3f5911a056d3dbc4bfd724740244a3a9c11575ef (diff)
downloadydb-0cdbcf332f1f329f0a3d6759462ad71e7867ac08.tar.gz
Restoring authorship annotation for <sandello@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
-rw-r--r--library/cpp/lfalloc/lf_allocX64.h296
-rw-r--r--library/cpp/malloc/api/malloc.cpp8
-rw-r--r--library/cpp/malloc/api/malloc.h6
-rw-r--r--library/cpp/testing/common/probe.h2
-rw-r--r--library/cpp/yt/coding/varint-inl.h16
-rw-r--r--library/cpp/yt/coding/varint.h16
-rw-r--r--library/cpp/yt/coding/zig_zag.h26
-rw-r--r--library/cpp/yt/memory/blob.cpp2
-rw-r--r--library/cpp/yt/memory/intrusive_ptr.h166
-rw-r--r--library/cpp/yt/memory/leaky_singleton.h2
-rw-r--r--library/cpp/yt/memory/ref.cpp18
-rw-r--r--library/cpp/yt/memory/ref.h72
-rw-r--r--library/cpp/yt/memory/ref_counted.h4
-rw-r--r--library/cpp/yt/misc/port.h4
-rw-r--r--library/cpp/yt/misc/property.h2
-rw-r--r--library/cpp/yt/string/format-inl.h6
-rw-r--r--library/cpp/yt/string/format.h2
-rw-r--r--library/cpp/yt/string/string.cpp16
-rw-r--r--library/cpp/yt/string/string.h22
-rw-r--r--library/cpp/yt/yson_string/string.cpp2
-rw-r--r--library/cpp/yt/yson_string/string.h2
21 files changed, 345 insertions, 345 deletions
diff --git a/library/cpp/lfalloc/lf_allocX64.h b/library/cpp/lfalloc/lf_allocX64.h
index fd2a906d6f..37514b6bb3 100644
--- a/library/cpp/lfalloc/lf_allocX64.h
+++ b/library/cpp/lfalloc/lf_allocX64.h
@@ -5,7 +5,7 @@
#include <stdarg.h>
#include <library/cpp/malloc/api/malloc.h>
-
+
#include <util/system/compat.h>
#include <util/system/compiler.h>
#include <util/system/types.h>
@@ -165,15 +165,15 @@ inline T* DoCas(T* volatile* target, T* exchange, T* compare) {
}
#ifdef _64_
-const uintptr_t N_MAX_WORKSET_SIZE = 0x100000000ll * 200;
-const uintptr_t N_HUGE_AREA_FINISH = 0x700000000000ll;
+const uintptr_t N_MAX_WORKSET_SIZE = 0x100000000ll * 200;
+const uintptr_t N_HUGE_AREA_FINISH = 0x700000000000ll;
#ifndef _freebsd_
-const uintptr_t LINUX_MMAP_AREA_START = 0x100000000ll;
-static uintptr_t volatile linuxAllocPointer = LINUX_MMAP_AREA_START;
-static uintptr_t volatile linuxAllocPointerHuge = LINUX_MMAP_AREA_START + N_MAX_WORKSET_SIZE;
+const uintptr_t LINUX_MMAP_AREA_START = 0x100000000ll;
+static uintptr_t volatile linuxAllocPointer = LINUX_MMAP_AREA_START;
+static uintptr_t volatile linuxAllocPointerHuge = LINUX_MMAP_AREA_START + N_MAX_WORKSET_SIZE;
#endif
#else
-const uintptr_t N_MAX_WORKSET_SIZE = 0xffffffff;
+const uintptr_t N_MAX_WORKSET_SIZE = 0xffffffff;
#endif
#define ALLOC_START ((char*)0)
@@ -182,11 +182,11 @@ const size_t N_CHUNKS = N_MAX_WORKSET_SIZE / N_CHUNK_SIZE;
const size_t N_LARGE_ALLOC_SIZE = N_CHUNK_SIZE * 128;
// map size idx to size in bytes
-#ifdef LFALLOC_YT
-const int N_SIZES = 27;
-#else
+#ifdef LFALLOC_YT
+const int N_SIZES = 27;
+#else
const int N_SIZES = 25;
-#endif
+#endif
const int nSizeIdxToSize[N_SIZES] = {
-1,
#if defined(_64_)
@@ -202,16 +202,16 @@ const int nSizeIdxToSize[N_SIZES] = {
128,
#endif
192, 256, 384, 512, 768, 1024, 1536, 2048,
- 3072, 4096, 6144, 8192, 12288, 16384, 24576, 32768,
-#ifdef LFALLOC_YT
- 49152, 65536
-#endif
+ 3072, 4096, 6144, 8192, 12288, 16384, 24576, 32768,
+#ifdef LFALLOC_YT
+ 49152, 65536
+#endif
};
-#ifdef LFALLOC_YT
-const size_t N_MAX_FAST_SIZE = 65536;
-#else
+#ifdef LFALLOC_YT
+const size_t N_MAX_FAST_SIZE = 65536;
+#else
const size_t N_MAX_FAST_SIZE = 32768;
-#endif
+#endif
const unsigned char size2idxArr1[64 + 1] = {
1,
#if defined(_64_)
@@ -225,11 +225,11 @@ const unsigned char size2idxArr1[64 + 1] = {
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, // 384
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 // 512
};
-#ifdef LFALLOC_YT
-const unsigned char size2idxArr2[256] = {
-#else
+#ifdef LFALLOC_YT
+const unsigned char size2idxArr2[256] = {
+#else
const unsigned char size2idxArr2[128] = {
-#endif
+#endif
12, 12, 13, 14, // 512, 512, 768, 1024
15, 15, 16, 16, // 1536, 2048
17, 17, 17, 17, 18, 18, 18, 18, // 3072, 4096
@@ -240,7 +240,7 @@ const unsigned char size2idxArr2[128] = {
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, // 24576
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 32768
-#ifdef LFALLOC_YT
+#ifdef LFALLOC_YT
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
@@ -249,7 +249,7 @@ const unsigned char size2idxArr2[128] = {
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, // 65536
-#endif
+#endif
};
// map entry number to size idx
@@ -290,12 +290,12 @@ enum ELFAllocCounter {
CT_LARGE_FREE, // accumulated deallocated size for large blocks
CT_SLOW_ALLOC_CNT, // number of slow (not LF) allocations
CT_DEGRAGMENT_CNT, // number of memory defragmentations
- CT_MAX
-};
-
+ CT_MAX
+};
+
static Y_FORCE_INLINE void IncrementCounter(ELFAllocCounter counter, size_t value);
-
-//////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////
enum EMMapMode {
MM_NORMAL, // memory for small allocs
MM_HUGE // memory for large allocs
@@ -385,8 +385,8 @@ static char* AllocWithMMap(uintptr_t sz, EMMapMode mode) {
#endif
#endif
Y_ASSERT_NOBT(largeBlock);
- IncrementCounter(CT_MMAP, sz);
- IncrementCounter(CT_MMAP_CNT, 1);
+ IncrementCounter(CT_MMAP, sz);
+ IncrementCounter(CT_MMAP_CNT, 1);
return largeBlock;
}
@@ -431,7 +431,7 @@ static void LargeBlockUnmap(void* p, size_t pages) {
const auto bytes = (pages + 1) * uintptr_t(4096);
IncrementCounter(CT_MUNMAP, bytes);
- IncrementCounter(CT_MUNMAP_CNT, 1);
+ IncrementCounter(CT_MUNMAP_CNT, 1);
#ifdef _MSC_VER
Y_ASSERT_NOBT(0);
#else
@@ -439,11 +439,11 @@ static void LargeBlockUnmap(void* p, size_t pages) {
munmap((char*)p - 4096ll, bytes);
#endif
}
-
+
//////////////////////////////////////////////////////////////////////////
const size_t LB_BUF_SIZE = 250;
const size_t LB_BUF_HASH = 977;
-static int LB_LIMIT_TOTAL_SIZE = 500 * 1024 * 1024 / 4096; // do not keep more then this mem total in lbFreePtrs[]
+static int LB_LIMIT_TOTAL_SIZE = 500 * 1024 * 1024 / 4096; // do not keep more then this mem total in lbFreePtrs[]
static void* volatile lbFreePtrs[LB_BUF_HASH][LB_BUF_SIZE];
static TAtomic lbFreePageCount;
@@ -456,10 +456,10 @@ static void* LargeBlockAlloc(size_t _nSize, ELFAllocCounter counter) {
NMalloc::AbortFromCorruptedAllocator("out of memory");
}
#else
-
- IncrementCounter(counter, pgCount * 4096ll);
- IncrementCounter(CT_SYSTEM_ALLOC, 4096ll);
-
+
+ IncrementCounter(counter, pgCount * 4096ll);
+ IncrementCounter(CT_SYSTEM_ALLOC, 4096ll);
+
int lbHash = pgCount % LB_BUF_HASH;
for (int i = 0; i < LB_BUF_SIZE; ++i) {
void* p = lbFreePtrs[lbHash][i];
@@ -516,9 +516,9 @@ static void LargeBlockFree(void* p, ELFAllocCounter counter) {
size_t pgCount = TLargeBlk::As(p)->Pages;
TLargeBlk::As(p)->Mark(ELarge::Free);
- IncrementCounter(counter, pgCount * 4096ll);
- IncrementCounter(CT_SYSTEM_FREE, 4096ll);
-
+ IncrementCounter(counter, pgCount * 4096ll);
+ IncrementCounter(CT_SYSTEM_FREE, 4096ll);
+
if (lbFreePageCount > LB_LIMIT_TOTAL_SIZE)
FreeAllLargeBlockMem();
int lbHash = pgCount % LB_BUF_HASH;
@@ -537,15 +537,15 @@ static void LargeBlockFree(void* p, ELFAllocCounter counter) {
static void* SystemAlloc(size_t _nSize) {
//HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, _nSize);
- return LargeBlockAlloc(_nSize, CT_SYSTEM_ALLOC);
+ return LargeBlockAlloc(_nSize, CT_SYSTEM_ALLOC);
}
static void SystemFree(void* p) {
//HeapFree(GetProcessHeap(), 0, p);
- LargeBlockFree(p, CT_SYSTEM_FREE);
+ LargeBlockFree(p, CT_SYSTEM_FREE);
}
+
-
-//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
char* const LF_LOCK_FREE = ((char*)0) + 0;
char* const LF_LOCK_LOCKED = ((char*)0) + 1;
char* const LF_LOCK_FUTEX_WAIT = ((char*)0) + 2;
@@ -638,7 +638,7 @@ public:
if (lk->TryLock()) {
LockData = lk;
return true;
- }
+ }
if ((++Attempt & SleepMask) == 0) {
lk->FutexWait();
SleepMask = (SleepMask * 2 + 1) & 0x7fff;
@@ -650,12 +650,12 @@ public:
#endif
}
return false;
- }
+ }
~TLFLockHolder() {
if (LockData) {
LockData->Unlock();
- }
- }
+ }
+ }
};
//////////////////////////////////////////////////////////////////////////
@@ -775,10 +775,10 @@ const int FREE_LIST_GROUP_SIZEIDX = 6;
// find free chunks and reset chunk size so they can be reused by different sized allocations
// do not look at blockFreeList (TFreeListGroup has same size for any allocations)
static bool DefragmentMem() {
- if (!EnableDefrag) {
- return false;
- }
-
+ if (!EnableDefrag) {
+ return false;
+ }
+
IncrementCounter(CT_DEGRAGMENT_CNT, 1);
int* nFreeCount = (int*)SystemAlloc(N_CHUNKS * sizeof(int));
@@ -1002,39 +1002,39 @@ static Y_FORCE_INLINE void PutBlocksToGlobalFreeList(ptrdiff_t nSizeIdx, char**
}
//////////////////////////////////////////////////////////////////////////
-static TAtomic GlobalCounters[CT_MAX];
-const int MAX_LOCAL_UPDATES = 100;
+static TAtomic GlobalCounters[CT_MAX];
+const int MAX_LOCAL_UPDATES = 100;
const intptr_t MAX_LOCAL_DELTA = 1*1024*1024;
-
-struct TLocalCounter {
- intptr_t Value;
- int Updates;
- TAtomic* Parent;
-
+
+struct TLocalCounter {
+ intptr_t Value;
+ int Updates;
+ TAtomic* Parent;
+
Y_FORCE_INLINE void Init(TAtomic* parent) {
- Parent = parent;
- Value = 0;
- Updates = 0;
- }
-
+ Parent = parent;
+ Value = 0;
+ Updates = 0;
+ }
+
Y_FORCE_INLINE void Increment(size_t value) {
- Value += value;
+ Value += value;
if (++Updates > MAX_LOCAL_UPDATES || Value > MAX_LOCAL_DELTA) {
- Flush();
- }
- }
-
+ Flush();
+ }
+ }
+
Y_FORCE_INLINE void Flush() {
- AtomicAdd(*Parent, Value);
- Value = 0;
- Updates = 0;
- }
-};
-
+ AtomicAdd(*Parent, Value);
+ Value = 0;
+ Updates = 0;
+ }
+};
+
////////////////////////////////////////////////////////////////////////////////
// DBG stuff
////////////////////////////////////////////////////////////////////////////////
-
+
#if defined(LFALLOC_DBG)
struct TPerTagAllocCounter {
@@ -1095,7 +1095,7 @@ static TPerTagAllocCounter GlobalPerTagAllocCounters[DBG_ALLOC_MAX_TAG][DBG_ALLO
#endif // LFALLOC_DBG
-//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
const int THREAD_BUF = 256;
static int borderSizes[N_SIZES];
const int MAX_MEM_PER_SIZE_PER_THREAD = 512 * 1024;
@@ -1105,8 +1105,8 @@ struct TThreadAllocInfo {
char* FreePtrs[N_SIZES][THREAD_BUF];
int FreePtrIndex[N_SIZES];
TThreadAllocInfo* pNextInfo;
- TLocalCounter LocalCounters[CT_MAX];
-
+ TLocalCounter LocalCounters[CT_MAX];
+
#if defined(LFALLOC_DBG)
TLocalPerTagAllocCounter LocalPerTagAllocCounters[DBG_ALLOC_MAX_TAG][DBG_ALLOC_NUM_SIZES];
#endif
@@ -1133,9 +1133,9 @@ struct TThreadAllocInfo {
maxCount = THREAD_BUF;
borderSizes[k] = THREAD_BUF - maxCount;
}
- for (int i = 0; i < CT_MAX; ++i) {
- LocalCounters[i].Init(&GlobalCounters[i]);
- }
+ for (int i = 0; i < CT_MAX; ++i) {
+ LocalCounters[i].Init(&GlobalCounters[i]);
+ }
#if defined(LFALLOC_DBG)
for (int tag = 0; tag < DBG_ALLOC_MAX_TAG; ++tag) {
for (int sizeIdx = 0; sizeIdx < DBG_ALLOC_NUM_SIZES; ++sizeIdx) {
@@ -1151,7 +1151,7 @@ struct TThreadAllocInfo {
}
for (auto& localCounter : LocalCounters) {
localCounter.Flush();
- }
+ }
#if defined(LFALLOC_DBG)
for (int tag = 0; tag < DBG_ALLOC_MAX_TAG; ++tag) {
for (int sizeIdx = 0; sizeIdx < DBG_ALLOC_NUM_SIZES; ++sizeIdx) {
@@ -1173,41 +1173,41 @@ static TThreadAllocInfo* pThreadInfoList;
static TLFLockData LFLockThreadInfo;
static Y_FORCE_INLINE void IncrementCounter(ELFAllocCounter counter, size_t value) {
-#ifdef LFALLOC_YT
- TThreadAllocInfo* thr = pThreadInfo;
- if (thr) {
- thr->LocalCounters[counter].Increment(value);
- } else {
- AtomicAdd(GlobalCounters[counter], value);
- }
-#endif
-}
-
+#ifdef LFALLOC_YT
+ TThreadAllocInfo* thr = pThreadInfo;
+ if (thr) {
+ thr->LocalCounters[counter].Increment(value);
+ } else {
+ AtomicAdd(GlobalCounters[counter], value);
+ }
+#endif
+}
+
extern "C" i64 GetLFAllocCounterFast(int counter) {
-#ifdef LFALLOC_YT
- return GlobalCounters[counter];
-#else
- return 0;
-#endif
-}
-
+#ifdef LFALLOC_YT
+ return GlobalCounters[counter];
+#else
+ return 0;
+#endif
+}
+
extern "C" i64 GetLFAllocCounterFull(int counter) {
-#ifdef LFALLOC_YT
- i64 ret = GlobalCounters[counter];
- {
+#ifdef LFALLOC_YT
+ i64 ret = GlobalCounters[counter];
+ {
TLFLockHolder ll(&LFLockThreadInfo);
for (TThreadAllocInfo** p = &pThreadInfoList; *p;) {
TThreadAllocInfo* pInfo = *p;
- ret += pInfo->LocalCounters[counter].Value;
- p = &pInfo->pNextInfo;
- }
- }
- return ret;
-#else
- return 0;
-#endif
-}
-
+ ret += pInfo->LocalCounters[counter].Value;
+ p = &pInfo->pNextInfo;
+ }
+ }
+ return ret;
+#else
+ return 0;
+#endif
+}
+
static void MoveSingleThreadFreeToGlobal(TThreadAllocInfo* pInfo) {
for (int sizeIdx = 0; sizeIdx < N_SIZES; ++sizeIdx) {
int& freePtrIdx = pInfo->FreePtrIndex[sizeIdx];
@@ -1510,8 +1510,8 @@ static Y_FORCE_INLINE void* LFAllocImpl(size_t _nSize) {
_nSize += sizeof(TAllocHeader);
#endif
- IncrementCounter(CT_USER_ALLOC, _nSize);
-
+ IncrementCounter(CT_USER_ALLOC, _nSize);
+
int nSizeIdx;
if (_nSize > 512) {
if (_nSize > N_MAX_FAST_SIZE) {
@@ -1525,8 +1525,8 @@ static Y_FORCE_INLINE void* LFAllocImpl(size_t _nSize) {
} else
nSizeIdx = size2idxArr1[1 + (((int)_nSize - 1) >> 3)];
- IncrementCounter(CT_SMALL_ALLOC, nSizeIdxToSize[nSizeIdx]);
-
+ IncrementCounter(CT_SMALL_ALLOC, nSizeIdxToSize[nSizeIdx]);
+
// check per thread buffer
TThreadAllocInfo* thr = pThreadInfo;
if (!thr) {
@@ -1595,7 +1595,7 @@ static Y_FORCE_INLINE void LFFree(void* p) {
#if defined(LFALLOC_DBG)
TrackDeallocation(p, N_SIZES);
#endif
- LargeBlockFree(p, CT_LARGE_FREE);
+ LargeBlockFree(p, CT_LARGE_FREE);
return;
}
@@ -1605,7 +1605,7 @@ static Y_FORCE_INLINE void LFFree(void* p) {
#if defined(LFALLOC_DBG)
TrackDeallocation(p, N_SIZES);
#endif
- LargeBlockFree(p, CT_LARGE_FREE);
+ LargeBlockFree(p, CT_LARGE_FREE);
return;
}
@@ -1616,9 +1616,9 @@ static Y_FORCE_INLINE void LFFree(void* p) {
#ifdef DBG_FILL_MEMORY
memset(p, 0xfe, nSizeIdxToSize[nSizeIdx]);
#endif
-
- IncrementCounter(CT_SMALL_FREE, nSizeIdxToSize[nSizeIdx]);
-
+
+ IncrementCounter(CT_SMALL_FREE, nSizeIdxToSize[nSizeIdx]);
+
// try to store info to per thread buf
TThreadAllocInfo* thr = pThreadInfo;
if (thr) {
@@ -1806,17 +1806,17 @@ void DumpMemoryBlockUtilization() {
}
//////////////////////////////////////////////////////////////////////////
-// malloc api
-
-static bool LFAlloc_SetParam(const char* param, const char* value) {
- if (!strcmp(param, "LB_LIMIT_TOTAL_SIZE")) {
- LB_LIMIT_TOTAL_SIZE = atoi(value);
- return true;
- }
- if (!strcmp(param, "LB_LIMIT_TOTAL_SIZE_BYTES")) {
- LB_LIMIT_TOTAL_SIZE = (atoi(value) + N_PAGE_SIZE - 1) / N_PAGE_SIZE;
- return true;
- }
+// malloc api
+
+static bool LFAlloc_SetParam(const char* param, const char* value) {
+ if (!strcmp(param, "LB_LIMIT_TOTAL_SIZE")) {
+ LB_LIMIT_TOTAL_SIZE = atoi(value);
+ return true;
+ }
+ if (!strcmp(param, "LB_LIMIT_TOTAL_SIZE_BYTES")) {
+ LB_LIMIT_TOTAL_SIZE = (atoi(value) + N_PAGE_SIZE - 1) / N_PAGE_SIZE;
+ return true;
+ }
#ifdef DBG_FILL_MEMORY
if (!strcmp(param, "FillMemoryOnAllocation")) {
FillMemoryOnAllocation = !strcmp(value, "true");
@@ -1831,14 +1831,14 @@ static bool LFAlloc_SetParam(const char* param, const char* value) {
MapHugeTLB = !strcmp(value, "true");
return true;
}
- if (!strcmp(param, "EnableDefrag")) {
- EnableDefrag = !strcmp(value, "true");
- return true;
- }
- return false;
-};
-
-static const char* LFAlloc_GetParam(const char* param) {
+ if (!strcmp(param, "EnableDefrag")) {
+ EnableDefrag = !strcmp(value, "true");
+ return true;
+ }
+ return false;
+};
+
+static const char* LFAlloc_GetParam(const char* param) {
struct TParam {
const char* Name;
const char* Value;
@@ -1864,10 +1864,10 @@ static const char* LFAlloc_GetParam(const char* param) {
if (strcmp(param, Params[i].Name) == 0) {
return Params[i].Value;
}
- }
- return nullptr;
-}
-
+ }
+ return nullptr;
+}
+
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";
diff --git a/library/cpp/malloc/api/malloc.cpp b/library/cpp/malloc/api/malloc.cpp
index eed1c58a38..8bba944722 100644
--- a/library/cpp/malloc/api/malloc.cpp
+++ b/library/cpp/malloc/api/malloc.cpp
@@ -9,9 +9,9 @@ namespace {
}
const char* GetEmptyParam(const char*) {
- return nullptr;
- }
-
+ return nullptr;
+ }
+
bool CheckEmptyParam(const char*, bool defaultValue) {
return defaultValue;
}
@@ -23,7 +23,7 @@ namespace NMalloc {
TMallocInfo::TMallocInfo()
: Name()
, SetParam(SetEmptyParam)
- , GetParam(GetEmptyParam)
+ , GetParam(GetEmptyParam)
, CheckParam(CheckEmptyParam)
{
}
diff --git a/library/cpp/malloc/api/malloc.h b/library/cpp/malloc/api/malloc.h
index ebd545d6dd..b8c7c33e57 100644
--- a/library/cpp/malloc/api/malloc.h
+++ b/library/cpp/malloc/api/malloc.h
@@ -8,10 +8,10 @@ namespace NMalloc {
TMallocInfo();
const char* Name;
-
+
bool (*SetParam)(const char* param, const char* value);
- const char* (*GetParam)(const char* param);
-
+ const char* (*GetParam)(const char* param);
+
bool (*CheckParam)(const char* param, bool defaultValue);
};
diff --git a/library/cpp/testing/common/probe.h b/library/cpp/testing/common/probe.h
index 19910979b5..eeedfa0be7 100644
--- a/library/cpp/testing/common/probe.h
+++ b/library/cpp/testing/common/probe.h
@@ -104,7 +104,7 @@ namespace NTesting {
Y_ASSERT(State);
other.State = nullptr;
++State->MoveConstructors;
- }
+ }
TProbe& operator=(const TProbe& other) {
State = other.State;
diff --git a/library/cpp/yt/coding/varint-inl.h b/library/cpp/yt/coding/varint-inl.h
index f0a09e9d30..ade6cd98a3 100644
--- a/library/cpp/yt/coding/varint-inl.h
+++ b/library/cpp/yt/coding/varint-inl.h
@@ -29,7 +29,7 @@ Y_FORCE_INLINE int WriteVarUint64Impl(TWriteCallback doWrite, ui64 value)
}
// These are optimized versions of these Read/Write functions in protobuf/io/coded_stream.cc.
-Y_FORCE_INLINE int WriteVarUint64(IOutputStream* output, ui64 value)
+Y_FORCE_INLINE int WriteVarUint64(IOutputStream* output, ui64 value)
{
return WriteVarUint64Impl([&] (ui8 byte) {
output->Write(byte);
@@ -51,7 +51,7 @@ Y_FORCE_INLINE int WriteVarUint32Impl(TOutput output, ui32 value)
return WriteVarUint64(output, static_cast<ui64>(value));
}
-Y_FORCE_INLINE int WriteVarUint32(IOutputStream* output, ui32 value)
+Y_FORCE_INLINE int WriteVarUint32(IOutputStream* output, ui32 value)
{
return WriteVarUint32Impl(output, value);
}
@@ -69,7 +69,7 @@ Y_FORCE_INLINE int WriteVarInt32Impl(TOutput output, i32 value)
return WriteVarUint64(output, static_cast<ui64>(ZigZagEncode32(value)));
}
-Y_FORCE_INLINE int WriteVarInt32(IOutputStream* output, i32 value)
+Y_FORCE_INLINE int WriteVarInt32(IOutputStream* output, i32 value)
{
return WriteVarInt32Impl(output, value);
}
@@ -87,7 +87,7 @@ Y_FORCE_INLINE int WriteVarInt64Impl(TOutput output, i64 value)
return WriteVarUint64(output, static_cast<ui64>(ZigZagEncode64(value)));
}
-Y_FORCE_INLINE int WriteVarInt64(IOutputStream* output, i64 value)
+Y_FORCE_INLINE int WriteVarInt64(IOutputStream* output, i64 value)
{
return WriteVarInt64Impl(output, value);
}
@@ -119,7 +119,7 @@ Y_FORCE_INLINE int ReadVarUint64Impl(TReadCallback doRead, ui64* value)
return count;
}
-Y_FORCE_INLINE int ReadVarUint64(IInputStream* input, ui64* value)
+Y_FORCE_INLINE int ReadVarUint64(IInputStream* input, ui64* value)
{
return ReadVarUint64Impl([&] () {
char byte;
@@ -165,7 +165,7 @@ Y_FORCE_INLINE int ReadVarUint32Impl(ui32* value, Args... args)
return bytesRead;
}
-Y_FORCE_INLINE int ReadVarUint32(IInputStream* input, ui32* value)
+Y_FORCE_INLINE int ReadVarUint32(IInputStream* input, ui32* value)
{
return ReadVarUint32Impl(value, input);
}
@@ -194,7 +194,7 @@ Y_FORCE_INLINE int ReadVarInt32Impl(i32* value, Args... args)
return bytesRead;
}
-Y_FORCE_INLINE int ReadVarInt32(IInputStream* input, i32* value)
+Y_FORCE_INLINE int ReadVarInt32(IInputStream* input, i32* value)
{
return ReadVarInt32Impl(value, input);
}
@@ -220,7 +220,7 @@ Y_FORCE_INLINE int ReadVarInt64Impl(i64* value, Args... args)
return bytesRead;
}
-Y_FORCE_INLINE int ReadVarInt64(IInputStream* input, i64* value)
+Y_FORCE_INLINE int ReadVarInt64(IInputStream* input, i64* value)
{
return ReadVarInt64Impl(value, input);
}
diff --git a/library/cpp/yt/coding/varint.h b/library/cpp/yt/coding/varint.h
index c5399f8b06..6914c1d692 100644
--- a/library/cpp/yt/coding/varint.h
+++ b/library/cpp/yt/coding/varint.h
@@ -20,10 +20,10 @@ constexpr size_t MaxVarUint32Size = (8 * sizeof(ui32) - 1) / 7 + 1;
// Various functions to read/write varints.
// Returns the number of bytes written.
-int WriteVarUint64(IOutputStream* output, ui64 value);
-int WriteVarUint32(IOutputStream* output, ui32 value);
-int WriteVarInt32(IOutputStream* output, i32 value);
-int WriteVarInt64(IOutputStream* output, i64 value);
+int WriteVarUint64(IOutputStream* output, ui64 value);
+int WriteVarUint32(IOutputStream* output, ui32 value);
+int WriteVarInt32(IOutputStream* output, i32 value);
+int WriteVarInt64(IOutputStream* output, i64 value);
int WriteVarUint64(char* output, ui64 value);
int WriteVarUint32(char* output, ui32 value);
@@ -31,10 +31,10 @@ int WriteVarInt32(char* output, i32 value);
int WriteVarInt64(char* output, i64 value);
// Returns the number of bytes read.
-int ReadVarUint64(IInputStream* input, ui64* value);
-int ReadVarUint32(IInputStream* input, ui32* value);
-int ReadVarInt32(IInputStream* input, i32* value);
-int ReadVarInt64(IInputStream* input, i64* value);
+int ReadVarUint64(IInputStream* input, ui64* value);
+int ReadVarUint32(IInputStream* input, ui32* value);
+int ReadVarInt32(IInputStream* input, i32* value);
+int ReadVarInt64(IInputStream* input, i64* value);
int ReadVarUint64(const char* input, ui64* value);
int ReadVarUint32(const char* input, ui32* value);
diff --git a/library/cpp/yt/coding/zig_zag.h b/library/cpp/yt/coding/zig_zag.h
index aa6d425a1c..2cd19f85a1 100644
--- a/library/cpp/yt/coding/zig_zag.h
+++ b/library/cpp/yt/coding/zig_zag.h
@@ -1,23 +1,23 @@
-#pragma once
-
+#pragma once
+
#include <util/system/types.h>
-
-namespace NYT {
-
-////////////////////////////////////////////////////////////////////////////////
-
+
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
// These Functions provide coding of integers with property: 0 <= f(x) <= 2 * |x|
// Actually taken 'as is' from protobuf/wire_format_lite.h
-
+
ui32 ZigZagEncode32(i32 n);
i32 ZigZagDecode32(ui32 n);
-
+
ui64 ZigZagEncode64(i64 n);
i64 ZigZagDecode64(ui64 n);
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace NYT
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT
#define ZIG_ZAG_INL_H_
#include "zig_zag-inl.h"
diff --git a/library/cpp/yt/memory/blob.cpp b/library/cpp/yt/memory/blob.cpp
index 86000b033b..1a332a576f 100644
--- a/library/cpp/yt/memory/blob.cpp
+++ b/library/cpp/yt/memory/blob.cpp
@@ -161,7 +161,7 @@ void TBlob::Allocate(size_t newCapacity)
TRefCountedTrackerFacade::AllocateSpace(TagCookie_, newCapacity);
#endif
}
-
+
void TBlob::Reallocate(size_t newCapacity)
{
if (!Begin_) {
diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h
index 3dead7db1d..71d1e7c90c 100644
--- a/library/cpp/yt/memory/intrusive_ptr.h
+++ b/library/cpp/yt/memory/intrusive_ptr.h
@@ -13,9 +13,9 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
template <class T>
-class TIntrusivePtr
-{
-public:
+class TIntrusivePtr
+{
+public:
typedef T TUnderlying;
constexpr TIntrusivePtr() noexcept
@@ -34,67 +34,67 @@ public:
*/
TIntrusivePtr(T* obj, bool addReference = true) noexcept
: T_(obj)
- {
+ {
if (T_ && addReference) {
Ref(T_);
}
}
- //! Copy constructor.
+ //! Copy constructor.
TIntrusivePtr(const TIntrusivePtr& other) noexcept
: T_(other.Get())
- {
+ {
if (T_) {
Ref(T_);
- }
- }
+ }
+ }
//! Copy constructor with an upcast.
template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
TIntrusivePtr(const TIntrusivePtr<U>& other) noexcept
- : T_(other.Get())
- {
+ : T_(other.Get())
+ {
static_assert(
std::is_base_of_v<TRefCountedBase, T>,
"Cast allowed only for types derived from TRefCountedBase");
if (T_) {
Ref(T_);
}
- }
+ }
- //! Move constructor.
+ //! Move constructor.
TIntrusivePtr(TIntrusivePtr&& other) noexcept
: T_(other.Get())
- {
+ {
other.T_ = nullptr;
- }
-
+ }
+
//! Move constructor with an upcast.
template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
TIntrusivePtr(TIntrusivePtr<U>&& other) noexcept
- : T_(other.Get())
- {
+ : T_(other.Get())
+ {
static_assert(
std::is_base_of_v<TRefCountedBase, T>,
"Cast allowed only for types derived from TRefCountedBase");
other.T_ = nullptr;
- }
-
- //! Destructor.
- ~TIntrusivePtr()
- {
+ }
+
+ //! Destructor.
+ ~TIntrusivePtr()
+ {
if (T_) {
Unref(T_);
}
- }
+ }
- //! Copy assignment operator.
+ //! Copy assignment operator.
TIntrusivePtr& operator=(const TIntrusivePtr& other) noexcept
- {
- TIntrusivePtr(other).Swap(*this);
- return *this;
- }
-
+ {
+ TIntrusivePtr(other).Swap(*this);
+ return *this;
+ }
+
//! Copy assignment operator with an upcast.
template <class U>
TIntrusivePtr& operator=(const TIntrusivePtr<U>& other) noexcept
@@ -109,13 +109,13 @@ public:
return *this;
}
- //! Move assignment operator.
+ //! Move assignment operator.
TIntrusivePtr& operator=(TIntrusivePtr&& other) noexcept
- {
+ {
TIntrusivePtr(std::move(other)).Swap(*this);
- return *this;
- }
-
+ return *this;
+ }
+
//! Move assignment operator with an upcast.
template <class U>
TIntrusivePtr& operator=(TIntrusivePtr<U>&& other) noexcept
@@ -132,22 +132,22 @@ public:
//! Drop the pointer.
void Reset() // noexcept
- {
- TIntrusivePtr().Swap(*this);
- }
-
+ {
+ TIntrusivePtr().Swap(*this);
+ }
+
//! Replace the pointer with a specified one.
void Reset(T* p) // noexcept
- {
- TIntrusivePtr(p).Swap(*this);
- }
-
+ {
+ TIntrusivePtr(p).Swap(*this);
+ }
+
//! Returns the pointer.
T* Get() const noexcept
{
- return T_;
- }
-
+ return T_;
+ }
+
//! Returns the pointer and releases the ownership.
T* Release() noexcept
{
@@ -157,17 +157,17 @@ public:
}
T& operator*() const noexcept
- {
+ {
YT_ASSERT(T_);
- return *T_;
- }
-
+ return *T_;
+ }
+
T* operator->() const noexcept
- {
+ {
YT_ASSERT(T_);
return T_;
- }
-
+ }
+
explicit operator bool() const noexcept
{
return T_ != nullptr;
@@ -176,12 +176,12 @@ public:
//! Swap the pointer with the other one.
void Swap(TIntrusivePtr& r) noexcept
{
- DoSwap(T_, r.T_);
- }
-
-private:
+ DoSwap(T_, r.T_);
+ }
+
+private:
template <class U>
- friend class TIntrusivePtr;
+ friend class TIntrusivePtr;
T* T_ = nullptr;
};
@@ -268,59 +268,59 @@ bool operator>(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<T>& rhs)
}
template <class T, class U>
-bool operator==(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs)
-{
+bool operator==(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs)
+{
static_assert(
std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
- return lhs.Get() == rhs.Get();
-}
-
+ return lhs.Get() == rhs.Get();
+}
+
template <class T, class U>
-bool operator!=(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs)
-{
+bool operator!=(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs)
+{
static_assert(
std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
- return lhs.Get() != rhs.Get();
-}
-
+ return lhs.Get() != rhs.Get();
+}
+
template <class T, class U>
bool operator==(const TIntrusivePtr<T>& lhs, U* rhs)
-{
+{
static_assert(
std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
- return lhs.Get() == rhs;
-}
-
+ return lhs.Get() == rhs;
+}
+
template <class T, class U>
bool operator!=(const TIntrusivePtr<T>& lhs, U* rhs)
-{
+{
static_assert(
std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
- return lhs.Get() != rhs;
-}
-
+ return lhs.Get() != rhs;
+}
+
template <class T, class U>
bool operator==(T* lhs, const TIntrusivePtr<U>& rhs)
-{
+{
static_assert(
std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
- return lhs == rhs.Get();
-}
-
+ return lhs == rhs.Get();
+}
+
template <class T, class U>
bool operator!=(T* lhs, const TIntrusivePtr<U>& rhs)
-{
+{
static_assert(
std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
- return lhs != rhs.Get();
-}
-
+ return lhs != rhs.Get();
+}
+
template <class T>
bool operator==(std::nullptr_t, const TIntrusivePtr<T>& rhs)
{
diff --git a/library/cpp/yt/memory/leaky_singleton.h b/library/cpp/yt/memory/leaky_singleton.h
index 03b5e51d78..9ca0bb906d 100644
--- a/library/cpp/yt/memory/leaky_singleton.h
+++ b/library/cpp/yt/memory/leaky_singleton.h
@@ -22,7 +22,7 @@ private:
template <class T> \
friend class ::NYT::TLeakyStorage;
-template <class T>
+template <class T>
T* LeakySingleton();
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/memory/ref.cpp b/library/cpp/yt/memory/ref.cpp
index e8ff42e976..1ac4d4e99e 100644
--- a/library/cpp/yt/memory/ref.cpp
+++ b/library/cpp/yt/memory/ref.cpp
@@ -271,10 +271,10 @@ TSharedMutableRef TSharedMutableRef::MakeCopy(TRef ref, TRefCountedTypeCookie ta
TString ToString(TRef ref)
{
- return TString(ref.Begin(), ref.End());
+ return TString(ref.Begin(), ref.End());
}
-TString ToString(const TMutableRef& ref)
+TString ToString(const TMutableRef& ref)
{
return ToString(TRef(ref));
}
@@ -284,17 +284,17 @@ TString ToString(const TSharedRef& ref)
return ToString(TRef(ref));
}
-TString ToString(const TSharedMutableRef& ref)
+TString ToString(const TSharedMutableRef& ref)
{
return ToString(TRef(ref));
}
-size_t GetPageSize()
-{
- static const size_t PageSize = NSystemInfo::GetPageSize();
- return PageSize;
-}
-
+size_t GetPageSize()
+{
+ static const size_t PageSize = NSystemInfo::GetPageSize();
+ return PageSize;
+}
+
size_t RoundUpToPage(size_t bytes)
{
static const size_t PageSize = NSystemInfo::GetPageSize();
diff --git a/library/cpp/yt/memory/ref.h b/library/cpp/yt/memory/ref.h
index 73d19d9013..0f27d24c77 100644
--- a/library/cpp/yt/memory/ref.h
+++ b/library/cpp/yt/memory/ref.h
@@ -1,29 +1,29 @@
-#pragma once
-
+#pragma once
+
#include "new.h"
#include "range.h"
#include "shared_range.h"
#include <type_traits>
-namespace NYT {
-
-////////////////////////////////////////////////////////////////////////////////
-
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
// Forward declaration.
class TBlob;
//! A non-owning reference to a range of memory.
-class TRef
+class TRef
: public TRange<char>
-{
-public:
+{
+public:
//! Creates a null TRef.
TRef() = default;
-
+
//! Creates a TRef for a given block of memory.
TRef(const void* data, size_t size);
-
+
//! Creates a TRef for a given range of memory.
TRef(const void* begin, const void* end);
@@ -32,7 +32,7 @@ public:
//! Creates a non-owning TRef for a given blob.
static TRef FromBlob(const TBlob& blob);
-
+
//! Creates a non-owning TRef for a given string.
static TRef FromString(const TString& str);
@@ -45,11 +45,11 @@ public:
//! Creates a TRef for a part of existing range.
TRef Slice(size_t startOffset, size_t endOffset) const;
-
+
//! Compares the content for bitwise equality.
static bool AreBitwiseEqual(TRef lhs, TRef rhs);
};
-
+
////////////////////////////////////////////////////////////////////////////////
//! A non-owning reference to a mutable range of memory.
@@ -77,7 +77,7 @@ public:
//! Creates a non-owning TMutableRef for a given blob.
static TMutableRef FromBlob(TBlob& blob);
-
+
//! Creates a non-owning TMutableRef for a given pod structure.
template <class T>
static TMutableRef FromPod(T& data);
@@ -88,10 +88,10 @@ public:
//! Creates a TMutableRef for a part of existing range.
TMutableRef Slice(size_t startOffset, size_t endOffset) const;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
//! Default tag type for memory blocks allocated via TSharedRef.
/*!
* Each newly allocated TSharedRef blob is associated with a tag type
@@ -100,10 +100,10 @@ public:
struct TDefaultSharedBlobTag { };
//! A reference to a range of memory with shared ownership.
-class TSharedRef
+class TSharedRef
: public TSharedRange<char>
-{
-public:
+{
+public:
//! Creates a null TSharedRef.
TSharedRef() = default;
@@ -141,7 +141,7 @@ public:
//! Creates a TSharedRef for a given blob taking ownership of its content.
static TSharedRef FromBlob(TBlob&& blob);
-
+
//! Creates a copy of a given TRef.
//! The memory is marked with a given tag.
static TSharedRef MakeCopy(TRef ref, TRefCountedTypeCookie tagCookie);
@@ -150,13 +150,13 @@ public:
//! The memory is marked with a given tag.
template <class TTag>
static TSharedRef MakeCopy(TRef ref);
-
+
//! Creates a TSharedRef for a part of existing range.
TSharedRef Slice(size_t startOffset, size_t endOffset) const;
-
+
//! Creates a TSharedRef for a part of existing range.
TSharedRef Slice(const void* begin, const void* end) const;
-
+
//! Creates a vector of slices with specified size.
std::vector<TSharedRef> Split(size_t partSize) const;
@@ -189,13 +189,13 @@ public:
//! Converts a TSharedMutableRef to TMutableRef.
operator TMutableRef() const;
-
+
//! Converts a TSharedMutableRef to TSharedRef.
operator TSharedRef() const;
-
+
//! Converts a TSharedMutableRef to TRef.
operator TRef() const;
-
+
//! Allocates a new shared block of memory.
//! The memory is marked with a given tag.
@@ -301,8 +301,8 @@ private:
size_t poolCapacity,
TRefCountedTypeCookie cookie,
As&&... args);
-};
-
+};
+
// STL interop.
const TSharedRef* begin(const TSharedRefArray& array);
const TSharedRef* end(const TSharedRefArray& array);
@@ -361,11 +361,11 @@ private:
////////////////////////////////////////////////////////////////////////////////
TString ToString(TRef ref);
-TString ToString(const TMutableRef& ref);
-TString ToString(const TSharedRef& ref);
-TString ToString(const TSharedMutableRef& ref);
+TString ToString(const TMutableRef& ref);
+TString ToString(const TSharedRef& ref);
+TString ToString(const TSharedMutableRef& ref);
-size_t GetPageSize();
+size_t GetPageSize();
size_t RoundUpToPage(size_t bytes);
size_t GetByteSize(TRef ref);
@@ -377,7 +377,7 @@ size_t GetByteSize(const std::vector<T>& parts);
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYT
+} // namespace NYT
#define REF_INL_H_
#include "ref-inl.h"
diff --git a/library/cpp/yt/memory/ref_counted.h b/library/cpp/yt/memory/ref_counted.h
index b683615b83..5b8b9faba7 100644
--- a/library/cpp/yt/memory/ref_counted.h
+++ b/library/cpp/yt/memory/ref_counted.h
@@ -6,8 +6,8 @@
#include <library/cpp/ytalloc/api/ytalloc.h>
-#include <atomic>
-
+#include <atomic>
+
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/misc/port.h b/library/cpp/yt/misc/port.h
index b24ac50995..daa0ae94e6 100644
--- a/library/cpp/yt/misc/port.h
+++ b/library/cpp/yt/misc/port.h
@@ -1,5 +1,5 @@
-#pragma once
-
+#pragma once
+
#include <util/system/platform.h>
// Check platform bitness.
diff --git a/library/cpp/yt/misc/property.h b/library/cpp/yt/misc/property.h
index bef8024ae1..17838bd472 100644
--- a/library/cpp/yt/misc/property.h
+++ b/library/cpp/yt/misc/property.h
@@ -115,7 +115,7 @@ public: \
Y_FORCE_INLINE void Set##name(type value) \
{ \
name##_ = value; \
- } \
+ } \
//! Defines a trivial public read-write property that is passed by value.
//! All arguments after name are used as default value (via braced-init-list).
diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h
index 5484d4a216..00c6b77496 100644
--- a/library/cpp/yt/string/format-inl.h
+++ b/library/cpp/yt/string/format-inl.h
@@ -109,7 +109,7 @@ inline void FormatValue(TStringBuilderBase* builder, TStringBuf value, TStringBu
}
}
-// TString
+// TString
inline void FormatValue(TStringBuilderBase* builder, const TString& value, TStringBuf format)
{
FormatValue(builder, TStringBuf(value), format);
@@ -450,7 +450,7 @@ void FormatValueViaSprintf(
auto copyFormat = [] (char* destination, const char* source, int length) {
int position = 0;
- for (int index = 0; index < length; ++index) {
+ for (int index = 0; index < length; ++index) {
if (IsQuotationSpecSymbol(source[index])) {
continue;
}
@@ -730,7 +730,7 @@ TString Format(
}
template <class... TArgs>
-TString Format(
+TString Format(
TStringBuf format,
TArgs&&... args)
{
diff --git a/library/cpp/yt/string/format.h b/library/cpp/yt/string/format.h
index 9708fe5906..e3a6aa9c38 100644
--- a/library/cpp/yt/string/format.h
+++ b/library/cpp/yt/string/format.h
@@ -33,7 +33,7 @@ namespace NYT {
*
* The following argument types are supported:
*
- * Strings (including |const char*|, |TStringBuf|, and |TString|) and chars:
+ * Strings (including |const char*|, |TStringBuf|, and |TString|) and chars:
* Emitted as is. Fast.
*
* Numerics and pointers:
diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp
index 7440ac3fdd..b24a2c4aa5 100644
--- a/library/cpp/yt/string/string.cpp
+++ b/library/cpp/yt/string/string.cpp
@@ -13,22 +13,22 @@ namespace NYT {
void UnderscoreCaseToCamelCase(TStringBuilderBase* builder, TStringBuf str)
{
- bool first = true;
+ bool first = true;
bool upper = true;
for (char c : str) {
if (c == '_') {
upper = true;
} else {
if (upper) {
- if (!std::isalpha(c) && !first) {
+ if (!std::isalpha(c) && !first) {
builder->AppendChar('_');
- }
+ }
c = std::toupper(c);
}
builder->AppendChar(c);
upper = false;
}
- first = false;
+ first = false;
}
}
@@ -43,11 +43,11 @@ void CamelCaseToUnderscoreCase(TStringBuilderBase* builder, TStringBuf str)
{
bool first = true;
for (char c : str) {
- if (std::isupper(c) && std::isalpha(c)) {
+ if (std::isupper(c) && std::isalpha(c)) {
if (!first) {
builder->AppendChar('_');
}
- c = std::tolower(c);
+ c = std::tolower(c);
}
builder->AppendChar(c);
first = false;
@@ -63,7 +63,7 @@ TString CamelCaseToUnderscoreCase(TStringBuf str)
////////////////////////////////////////////////////////////////////////////////
-TString TrimLeadingWhitespaces(const TString& str)
+TString TrimLeadingWhitespaces(const TString& str)
{
for (int i = 0; i < static_cast<int>(str.size()); ++i) {
if (str[i] != ' ') {
@@ -73,7 +73,7 @@ TString TrimLeadingWhitespaces(const TString& str)
return "";
}
-TString Trim(const TString& str, const TString& whitespaces)
+TString Trim(const TString& str, const TString& whitespaces)
{
size_t end = str.size();
while (end > 0) {
diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h
index ae6c99caab..b2b4ef23fd 100644
--- a/library/cpp/yt/string/string.h
+++ b/library/cpp/yt/string/string.h
@@ -64,7 +64,7 @@ void JoinToString(
}
template <class TIterator, class TFormatter>
-TString JoinToString(
+TString JoinToString(
const TIterator& begin,
const TIterator& end,
const TFormatter& formatter,
@@ -77,7 +77,7 @@ TString JoinToString(
//! A handy shortcut with default formatter.
template <class TIterator>
-TString JoinToString(
+TString JoinToString(
const TIterator& begin,
const TIterator& end,
TStringBuf delimiter = DefaultJoinToStringDelimiter)
@@ -92,7 +92,7 @@ TString JoinToString(
* \param delimiter A delimiter to be inserted between items; ", " by default.
*/
template <class TCollection, class TFormatter>
-TString JoinToString(
+TString JoinToString(
const TCollection& collection,
const TFormatter& formatter,
TStringBuf delimiter = DefaultJoinToStringDelimiter)
@@ -104,7 +104,7 @@ TString JoinToString(
//! A handy shortcut with the default formatter.
template <class TCollection>
-TString JoinToString(
+TString JoinToString(
const TCollection& collection,
TStringBuf delimiter = DefaultJoinToStringDelimiter)
{
@@ -127,13 +127,13 @@ TString ConcatToString(Ts... args)
//! Converts a range of items into strings.
template <class TIter, class TFormatter>
-std::vector<TString> ConvertToStrings(
+std::vector<TString> ConvertToStrings(
const TIter& begin,
const TIter& end,
const TFormatter& formatter,
size_t maxSize = std::numeric_limits<size_t>::max())
{
- std::vector<TString> result;
+ std::vector<TString> result;
for (auto it = begin; it != end; ++it) {
TStringBuilder builder;
formatter(&builder, *it);
@@ -147,7 +147,7 @@ std::vector<TString> ConvertToStrings(
//! A handy shortcut with the default formatter.
template <class TIter>
-std::vector<TString> ConvertToStrings(
+std::vector<TString> ConvertToStrings(
const TIter& begin,
const TIter& end,
size_t maxSize = std::numeric_limits<size_t>::max())
@@ -162,7 +162,7 @@ std::vector<TString> ConvertToStrings(
* \param maxSize Size limit for the resulting vector.
*/
template <class TCollection, class TFormatter>
-std::vector<TString> ConvertToStrings(
+std::vector<TString> ConvertToStrings(
const TCollection& collection,
const TFormatter& formatter,
size_t maxSize = std::numeric_limits<size_t>::max())
@@ -174,7 +174,7 @@ std::vector<TString> ConvertToStrings(
//! A handy shortcut with default formatter.
template <class TCollection>
-std::vector<TString> ConvertToStrings(
+std::vector<TString> ConvertToStrings(
const TCollection& collection,
size_t maxSize = std::numeric_limits<size_t>::max())
{
@@ -189,8 +189,8 @@ TString UnderscoreCaseToCamelCase(TStringBuf str);
void CamelCaseToUnderscoreCase(TStringBuilderBase* builder, TStringBuf str);
TString CamelCaseToUnderscoreCase(TStringBuf str);
-TString TrimLeadingWhitespaces(const TString& str);
-TString Trim(const TString& str, const TString& whitespaces);
+TString TrimLeadingWhitespaces(const TString& str);
+TString Trim(const TString& str, const TString& whitespaces);
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp
index 99d45e8616..7159279834 100644
--- a/library/cpp/yt/yson_string/string.cpp
+++ b/library/cpp/yt/yson_string/string.cpp
@@ -170,7 +170,7 @@ size_t TYsonString::ComputeHash() const
////////////////////////////////////////////////////////////////////////////////
-TString ToString(const TYsonString& yson)
+TString ToString(const TYsonString& yson)
{
return yson.ToString();
}
diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h
index e13af37a6d..971be8c106 100644
--- a/library/cpp/yt/yson_string/string.h
+++ b/library/cpp/yt/yson_string/string.h
@@ -128,7 +128,7 @@ bool operator != (const TYsonString& lhs, const TYsonStringBuf& rhs);
bool operator != (const TYsonStringBuf& lhs, const TYsonString& rhs);
bool operator != (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs);
-TString ToString(const TYsonString& yson);
+TString ToString(const TYsonString& yson);
TString ToString(const TYsonStringBuf& yson);
////////////////////////////////////////////////////////////////////////////////