diff options
author | yoda <yoda@yandex-team.ru> | 2022-02-10 16:50:00 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:00 +0300 |
commit | ddd64736134d6d92b80a934c8cf8228944ee4236 (patch) | |
tree | 145560960b5efdc61f39e36b4acbf2e0bf7c356d /util | |
parent | ae304bda46e224a4436a019a4f9181652ea4b370 (diff) | |
download | ydb-ddd64736134d6d92b80a934c8cf8228944ee4236.tar.gz |
Restoring authorship annotation for <yoda@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/digest/city.cpp | 8 | ||||
-rw-r--r-- | util/generic/ptr.h | 32 | ||||
-rw-r--r-- | util/generic/string_ut.h | 2 | ||||
-rw-r--r-- | util/system/execpath.cpp | 34 |
4 files changed, 38 insertions, 38 deletions
diff --git a/util/digest/city.cpp b/util/digest/city.cpp index c25f175d54..b75214ec4d 100644 --- a/util/digest/city.cpp +++ b/util/digest/city.cpp @@ -1,5 +1,5 @@ -#ifndef NO_CITYHASH - +#ifndef NO_CITYHASH + // Copyright (c) 2011 Google, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -309,7 +309,7 @@ uint128 CityHash128(const char* s, size_t len) noexcept { return CityHash128WithSeed(s, len, uint128(k0, k1)); } } - + // TODO(yazevnul): move this function to unittests void TestCompilationOfCityHashTemplates() { TStringBuf s; @@ -320,4 +320,4 @@ void TestCompilationOfCityHashTemplates() { CityHash128WithSeed(s, uint128(1, 2)); } -#endif +#endif diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 19db0e3ec5..14f6893d9b 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -610,7 +610,7 @@ struct THash<TIntrusivePtr<T, Ops>>: THash<const T*> { } }; -// Behaves like TIntrusivePtr but returns const T* to prevent user from accidentally modifying the referenced object. +// Behaves like TIntrusivePtr but returns const T* to prevent user from accidentally modifying the referenced object. template <class T, class Ops> class TIntrusiveConstPtr: public TPointerBase<TIntrusiveConstPtr<T, Ops>, const T> { public: @@ -620,17 +620,17 @@ public: Ops(); Ref(); } - + inline ~TIntrusiveConstPtr() { UnRef(); } - + inline TIntrusiveConstPtr(const TIntrusiveConstPtr& p) noexcept : T_(p.T_) { Ref(); } - + inline TIntrusiveConstPtr(TIntrusiveConstPtr&& p) noexcept : T_(nullptr) { @@ -642,7 +642,7 @@ public: { p.T_ = nullptr; } - + template <class U, class = TGuardConversion<T, U>> inline TIntrusiveConstPtr(const TIntrusiveConstPtr<U>& p) noexcept : T_(p.T_) @@ -659,10 +659,10 @@ public: inline TIntrusiveConstPtr& operator=(TIntrusiveConstPtr p) noexcept { p.Swap(*this); - + return *this; } - + // Effectively replace both: // Reset(const TIntrusiveConstPtr&) // Reset(TIntrusiveConstPtr&&) @@ -677,15 +677,15 @@ public: inline const T* Get() const noexcept { return T_; } - + inline void Swap(TIntrusiveConstPtr& r) noexcept { DoSwap(T_, r.T_); } - + inline void Drop() noexcept { TIntrusiveConstPtr(nullptr).Swap(*this); } - + inline long RefCount() const noexcept { return T_ ? Ops::RefCount(T_) : 0; } @@ -700,22 +700,22 @@ private: inline void Ref() noexcept { if (T_ != nullptr) { Ops::Ref(T_); - } + } } - + inline void UnRef() noexcept { if (T_ != nullptr) { Ops::UnRef(T_); - } + } } - + private: T* T_; template <class U, class O> friend class TIntrusiveConstPtr; -}; - +}; + template <class T, class Ops> struct THash<TIntrusiveConstPtr<T, Ops>>: THash<const T*> { using THash<const T*>::operator(); diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h index 44bb10bdeb..4eaa02c6c6 100644 --- a/util/generic/string_ut.h +++ b/util/generic/string_ut.h @@ -901,7 +901,7 @@ public: } catch (...) { Cerr << hash_val << Endl; throw; - }*/ + }*/ s2.assign(Data._0123456(), 2, 2); UNIT_ASSERT(s2 == Data._23()); diff --git a/util/system/execpath.cpp b/util/system/execpath.cpp index 33198af58b..21ae0f796d 100644 --- a/util/system/execpath.cpp +++ b/util/system/execpath.cpp @@ -18,10 +18,10 @@ #include <unistd.h> #endif -#include <util/folder/dirut.h> -#include <util/generic/singleton.h> +#include <util/folder/dirut.h> +#include <util/generic/singleton.h> #include <util/generic/function.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/memory/tempbuf.h> #include <util/stream/file.h> #include <util/stream/pipe.h> @@ -102,31 +102,31 @@ static inline bool FreeBSDGuessExecBasePath(const TString& guessBasePath, TStrin static TString GetExecPathImpl() { #if defined(_solaris_) - return execname(); + return execname(); #elif defined(_darwin_) TTempBuf execNameBuf; for (size_t i = 0; i < 2; ++i) { std::remove_pointer_t<TFunctionArg<decltype(_NSGetExecutablePath), 1>> bufsize = execNameBuf.Size(); - int r = _NSGetExecutablePath(execNameBuf.Data(), &bufsize); - if (r == 0) { - return execNameBuf.Data(); + int r = _NSGetExecutablePath(execNameBuf.Data(), &bufsize); + if (r == 0) { + return execNameBuf.Data(); } else if (r == -1) { execNameBuf = TTempBuf(bufsize); } - } + } ythrow yexception() << "GetExecPathImpl() failed"; #elif defined(_win_) TTempBuf execNameBuf; - for (;;) { + for (;;) { DWORD r = GetModuleFileName(nullptr, execNameBuf.Data(), execNameBuf.Size()); if (r == execNameBuf.Size()) { execNameBuf = TTempBuf(execNameBuf.Size() * 2); } else if (r == 0) { ythrow yexception() << "GetExecPathImpl() failed: " << LastSystemErrorText(); } else { - return execNameBuf.Data(); + return execNameBuf.Data(); } - } + } #elif defined(_linux_) || defined(_cygwin_) TString path("/proc/self/exe"); return NFs::ReadLink(path); @@ -135,26 +135,26 @@ static TString GetExecPathImpl() { TString execPath = FreeBSDGetExecPath(); if (GoodPath(execPath)) { return execPath; - } + } if (FreeBSDGuessExecPath(FreeBSDGetArgv0(), execPath)) { return execPath; - } + } if (FreeBSDGuessExecPath(getenv("_"), execPath)) { return execPath; - } + } if (FreeBSDGuessExecBasePath(getenv("PWD"), execPath)) { return execPath; } if (FreeBSDGuessExecBasePath(NFs::CurrentWorkingDirectory(), execPath)) { return execPath; } - + ythrow yexception() << "can not resolve exec path"; #else #error dont know how to implement GetExecPath on this platform #endif -} - +} + static bool GetPersistentExecPathImpl(TString& to) { #if defined(_solaris_) to = TString("/proc/self/object/a.out"); |