diff options
author | f0b0s <f0b0s@yandex-team.ru> | 2022-02-10 16:46:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:51 +0300 |
commit | deabc5260ac2e17b8f5152ee060bec1740613540 (patch) | |
tree | bc498b2fe3c447d13c2abea85b429fee8dd485ef /util | |
parent | 2e6009493e74f88988b81f219b301f450331648d (diff) | |
download | ydb-deabc5260ac2e17b8f5152ee060bec1740613540.tar.gz |
Restoring authorship annotation for <f0b0s@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/generic/guid.cpp | 56 | ||||
-rw-r--r-- | util/generic/guid.h | 12 | ||||
-rw-r--r-- | util/system/hp_timer.h | 28 | ||||
-rw-r--r-- | util/system/mem_info.cpp | 2 | ||||
-rw-r--r-- | util/system/thread.cpp | 2 | ||||
-rw-r--r-- | util/ysafeptr.h | 8 |
6 files changed, 54 insertions, 54 deletions
diff --git a/util/generic/guid.cpp b/util/generic/guid.cpp index 8b907457bc..39feb5b3e1 100644 --- a/util/generic/guid.cpp +++ b/util/generic/guid.cpp @@ -88,42 +88,42 @@ static bool GetDigit(const char c, ui32& digit) { } bool GetGuid(const TStringBuf s, TGUID& result) { - size_t partId = 0; - ui64 partValue = 0; - bool isEmptyPart = true; - - for (size_t i = 0; i != s.size(); ++i) { - const char c = s[i]; - - if (c == '-') { + size_t partId = 0; + ui64 partValue = 0; + bool isEmptyPart = true; + + for (size_t i = 0; i != s.size(); ++i) { + const char c = s[i]; + + if (c == '-') { if (isEmptyPart || partId == 3) { // x-y--z, -x-y-z or x-y-z-m-... return false; - } - result.dw[partId] = static_cast<ui32>(partValue); - ++partId; - partValue = 0; - isEmptyPart = true; - continue; - } - - ui32 digit = 0; + } + result.dw[partId] = static_cast<ui32>(partValue); + ++partId; + partValue = 0; + isEmptyPart = true; + continue; + } + + ui32 digit = 0; if (!GetDigit(c, digit)) { return false; - } - - partValue = partValue * 16 + digit; - isEmptyPart = false; - - // overflow check + } + + partValue = partValue * 16 + digit; + isEmptyPart = false; + + // overflow check if (partValue > Max<ui32>()) { return false; - } - } - + } + } + if (partId != 3 || isEmptyPart) { // x-y or x-y-z- return false; - } - result.dw[partId] = static_cast<ui32>(partValue); + } + result.dw[partId] = static_cast<ui32>(partValue); return true; } diff --git a/util/generic/guid.h b/util/generic/guid.h index 2bf6c8ad99..eef2937848 100644 --- a/util/generic/guid.h +++ b/util/generic/guid.h @@ -2,7 +2,7 @@ #include "fwd.h" -#include <util/str_stl.h> +#include <util/str_stl.h> /** * UUID generation @@ -58,13 +58,13 @@ struct TGUIDHash { } }; -template <> +template <> struct THash<TGUID> { constexpr size_t operator()(const TGUID& g) const noexcept { - return (unsigned int)TGUIDHash()(g); - } -}; - + return (unsigned int)TGUIDHash()(g); + } +}; + void CreateGuid(TGUID* res); TString GetGuidAsString(const TGUID& g); TString CreateGuidAsString(); diff --git a/util/system/hp_timer.h b/util/system/hp_timer.h index 0a4c252ec2..fe893017ab 100644 --- a/util/system/hp_timer.h +++ b/util/system/hp_timer.h @@ -14,23 +14,23 @@ namespace NHPTimer { double GetClockRate() noexcept; // same as GetClockRate, but in integer ui64 GetCyclesPerSecond() noexcept; -} - -struct THPTimer { +} + +struct THPTimer { THPTimer() noexcept { - Reset(); - } + Reset(); + } void Reset() noexcept { - NHPTimer::GetTime(&Start); - } + NHPTimer::GetTime(&Start); + } double Passed() const noexcept { - NHPTimer::STime tmp = Start; - return NHPTimer::GetTimePassed(&tmp); - } + NHPTimer::STime tmp = Start; + return NHPTimer::GetTimePassed(&tmp); + } double PassedReset() noexcept { - return NHPTimer::GetTimePassed(&Start); - } + return NHPTimer::GetTimePassed(&Start); + } -private: - NHPTimer::STime Start; +private: + NHPTimer::STime Start; }; diff --git a/util/system/mem_info.cpp b/util/system/mem_info.cpp index aa51ae3b16..bd6edc2076 100644 --- a/util/system/mem_info.cpp +++ b/util/system/mem_info.cpp @@ -148,7 +148,7 @@ namespace NMemInfo { } struct proc_taskinfo taskInfo; const int r = proc_pidinfo(pid, PROC_PIDTASKINFO, 0, &taskInfo, sizeof(taskInfo)); - + if (r != sizeof(taskInfo)) { int err = errno; TString errtxt = LastSystemErrorText(err); diff --git a/util/system/thread.cpp b/util/system/thread.cpp index 6236746c2d..3251c6e2e5 100644 --- a/util/system/thread.cpp +++ b/util/system/thread.cpp @@ -450,7 +450,7 @@ void TThread::SetCurrentThreadName(const char* name) { #if defined(_freebsd_) pthread_t thread = pthread_self(); - pthread_set_name_np(thread, name); + pthread_set_name_np(thread, name); #elif defined(_linux_) prctl(PR_SET_NAME, name, 0, 0, 0); #elif defined(_darwin_) diff --git a/util/ysafeptr.h b/util/ysafeptr.h index af7dfd4bed..4f815a5b4a 100644 --- a/util/ysafeptr.h +++ b/util/ysafeptr.h @@ -131,9 +131,9 @@ public: } #endif - // class name of derived class - virtual const char* GetClassName() const = 0; - + // class name of derived class + virtual const char* GetClassName() const = 0; + ui32 IsRefInvalid() const { return (ObjData & 0x80000000); } @@ -313,7 +313,7 @@ public: const char* GetClassName() const { return ptr->GetClassName(); } - + // assignment operators TPtrBase& operator=(TUserObj* _ptr) { Set(_ptr); |