diff options
author | vvvv <vvvv@yandex-team.ru> | 2022-02-10 16:46:34 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:34 +0300 |
commit | ad94e93a059747f4fc3d7add88d1a83daf40b733 (patch) | |
tree | 731d57e580bd143e1136e7747f13b26e6bac95d0 /util | |
parent | 298c6da79f1d8f35089a67f463f0b541bec36d9b (diff) | |
download | ydb-ad94e93a059747f4fc3d7add88d1a83daf40b733.tar.gz |
Restoring authorship annotation for <vvvv@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/datetime/base.cpp | 12 | ||||
-rw-r--r-- | util/folder/dirut.cpp | 2 | ||||
-rw-r--r-- | util/folder/fts.cpp | 16 | ||||
-rw-r--r-- | util/folder/fts.h | 6 | ||||
-rw-r--r-- | util/folder/lstat_win.c | 2 | ||||
-rw-r--r-- | util/folder/lstat_win.h | 2 | ||||
-rw-r--r-- | util/generic/buffer.cpp | 2 | ||||
-rw-r--r-- | util/network/socket.cpp | 4 | ||||
-rw-r--r-- | util/system/backtrace.cpp | 74 | ||||
-rw-r--r-- | util/system/backtrace.h | 2 | ||||
-rw-r--r-- | util/system/compiler.h | 12 | ||||
-rw-r--r-- | util/system/shellcommand.cpp | 14 | ||||
-rw-r--r-- | util/system/spinlock.h | 4 |
13 files changed, 76 insertions, 76 deletions
diff --git a/util/datetime/base.cpp b/util/datetime/base.cpp index 38ecc3ab96..0bc3943348 100644 --- a/util/datetime/base.cpp +++ b/util/datetime/base.cpp @@ -142,13 +142,13 @@ void Out<TDuration>(IOutputStream& os, TTypeTraits<TDuration>::TFuncParam durati template <> void Out<TInstant>(IOutputStream& os, TTypeTraits<TInstant>::TFuncParam instant) { - char buf[64]; - auto len = FormatDate8601(buf, sizeof(buf), instant.TimeT()); + char buf[64]; + auto len = FormatDate8601(buf, sizeof(buf), instant.TimeT()); - // shouldn't happen due to current implementation of FormatDate8601() and GmTimeR() + // shouldn't happen due to current implementation of FormatDate8601() and GmTimeR() Y_ENSURE(len, TStringBuf("Out<TInstant>: year does not fit into an integer")); - os.Write(buf, len - 1 /* 'Z' */); + os.Write(buf, len - 1 /* 'Z' */); WriteMicroSecondsToStream(os, instant.MicroSecondsOfSecond()); os << 'Z'; } @@ -186,8 +186,8 @@ TString TInstant::ToRfc822String() const { } TString TInstant::ToStringUpToSeconds() const { - char buf[64]; - auto len = FormatDate8601(buf, sizeof(buf), TimeT()); + char buf[64]; + auto len = FormatDate8601(buf, sizeof(buf), TimeT()); if (!len) { ythrow yexception() << "TInstant::ToStringUpToSeconds: year does not fit into an integer"; } diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index ffc9b09f96..07e986c729 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -1,7 +1,7 @@ #include "dirut.h" #include "iterator.h" #include "filelist.h" -#include "fts.h" +#include "fts.h" #include "pathsplit.h" #include "path.h" diff --git a/util/folder/fts.cpp b/util/folder/fts.cpp index 0e6a6f86eb..b715e5191e 100644 --- a/util/folder/fts.cpp +++ b/util/folder/fts.cpp @@ -1100,7 +1100,7 @@ fts_stat(FTS* sp, FTSENT* p, int follow) { dev_t dev; ino_t ino; - stat_struct *sbp, sb; + stat_struct *sbp, sb; int saved_errno; /* If user needs stat info, stat buffer already allocated. */ sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp; @@ -1122,19 +1122,19 @@ fts_stat(FTS* sp, FTSENT* p, int follow) * fail, set the errno from the stat call. */ if (ISSET(FTS_LOGICAL) || follow) { - if (STAT_FUNC(p->fts_accpath, sbp)) { + if (STAT_FUNC(p->fts_accpath, sbp)) { saved_errno = errno; if (!lstat(p->fts_accpath, sbp)) { errno = 0; return (FTS_SLNONE); } p->fts_errno = saved_errno; - memset(sbp, 0, sizeof(stat_struct)); + memset(sbp, 0, sizeof(stat_struct)); return (FTS_NS); } } else if (lstat(p->fts_accpath, sbp)) { p->fts_errno = errno; - memset(sbp, 0, sizeof(stat_struct)); + memset(sbp, 0, sizeof(stat_struct)); return (FTS_NS); } @@ -1239,7 +1239,7 @@ fts_alloc(FTS* sp, const char* name, int namelen) */ len = sizeof(FTSENT) + namelen; if (!ISSET(FTS_NOSTAT)) { - len += sizeof(stat_struct) + ALIGNBYTES; + len += sizeof(stat_struct) + ALIGNBYTES; } if ((p = (FTSENT*)malloc(len)) == nullptr) { return nullptr; @@ -1359,7 +1359,7 @@ static int fts_safe_changedir(FTS* sp, FTSENT* p, int fd, const char* path) { int ret, oerrno, newfd; - stat_struct sb; + stat_struct sb; newfd = fd; if (ISSET(FTS_NOCHDIR)) { @@ -1391,11 +1391,11 @@ static int fts_safe_changedir(FTS* sp, FTSENT* p, int /*fd*/, const char* path) { int ret; - stat_struct sb; + stat_struct sb; if (ISSET(FTS_NOCHDIR)) return (0); - if (STAT_FUNC(path, &sb)) { + if (STAT_FUNC(path, &sb)) { ret = -1; goto bail; } diff --git a/util/folder/fts.h b/util/folder/fts.h index f3c799e8c8..a70a35ca90 100644 --- a/util/folder/fts.h +++ b/util/folder/fts.h @@ -6,14 +6,14 @@ #ifndef _win32_ typedef int dird; -typedef struct stat stat_struct; +typedef struct stat stat_struct; #define STAT_FUNC stat #else #include <util/folder/dirent_win.h> typedef WCHAR* dird; typedef unsigned short u_short; typedef unsigned int nlink_t; -typedef struct _stat64 stat_struct; +typedef struct _stat64 stat_struct; #define STAT_FUNC stat64UTF //TODO: remove from global scope stat64UTF stat64UTF #ifdef __cplusplus @@ -97,7 +97,7 @@ typedef struct _ftsent { #define FTS_SKIP 4 /* discard node */ u_short fts_instr; /* yfts_set() instructions */ - stat_struct* fts_statp; /* stat(2) information */ + stat_struct* fts_statp; /* stat(2) information */ char fts_name[1]; /* file name */ } FTSENT; diff --git a/util/folder/lstat_win.c b/util/folder/lstat_win.c index cf94cec01a..d89a7a8d79 100644 --- a/util/folder/lstat_win.c +++ b/util/folder/lstat_win.c @@ -19,7 +19,7 @@ int lstat(const char* fileName, stat_struct* fileStat) { int result; result = _wstat64(buf, fileStat); if (result == 0) { - SetLastError(0); + SetLastError(0); findHandle = FindFirstFileW(buf, &findBuf); if (findBuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && (findBuf.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || findBuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) diff --git a/util/folder/lstat_win.h b/util/folder/lstat_win.h index 0bf7c19055..2a93dd716d 100644 --- a/util/folder/lstat_win.h +++ b/util/folder/lstat_win.h @@ -1,7 +1,7 @@ #pragma once #include <util/system/defaults.h> -#include "fts.h" +#include "fts.h" #ifdef _win_ #include <sys/stat.h> diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp index b92697e1d0..95586fb8ef 100644 --- a/util/generic/buffer.cpp +++ b/util/generic/buffer.cpp @@ -51,7 +51,7 @@ void TBuffer::Append(const char* buf, size_t len) { Y_ASSERT(len <= Avail()); - MemCopy(Data() + Pos_, buf, len); + MemCopy(Data() + Pos_, buf, len); NSan::Unpoison(Data() + Pos_, len); Pos_ += len; diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 4f6e804346..2b31e3e64f 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -1001,7 +1001,7 @@ private: }; public: - inline TImpl(const char* host, ui16 port, int flags) + inline TImpl(const char* host, ui16 port, int flags) : Info_(nullptr, TAddrInfoDeleter{}) { const TString port_st(ToString(port)); @@ -1060,7 +1060,7 @@ public: private: using TAddrInfoPtr = std::unique_ptr<struct addrinfo, TAddrInfoDeleter>; - + TAddrInfoPtr Info_; }; diff --git a/util/system/backtrace.cpp b/util/system/backtrace.cpp index b77fe58fb1..220a89e8b4 100644 --- a/util/system/backtrace.cpp +++ b/util/system/backtrace.cpp @@ -8,15 +8,15 @@ #include <util/generic/array_ref.h> #include <util/generic/string.h> -#ifdef _win_ +#ifdef _win_ #include "mutex.h" - + #ifndef OPTIONAL #define OPTIONAL #endif #include <dbghelp.h> -#endif - +#endif + #if defined(_bionic_) //TODO #else @@ -48,7 +48,7 @@ extern "C" __stdcall unsigned short CaptureStackBackTrace(unsigned long FramesTo #define HAVE_BACKTRACE #endif #endif - + #if defined(USE_GLIBC_BACKTRACE) #include <execinfo.h> @@ -104,12 +104,12 @@ size_t BackTrace(void** p, size_t len) { } #endif -#if defined(USE_WIN_BACKTRACE) -size_t BackTrace(void** p, size_t len) { - return CaptureStackBackTrace(0, len, p, nullptr); -} -#endif - +#if defined(USE_WIN_BACKTRACE) +size_t BackTrace(void** p, size_t len) { + return CaptureStackBackTrace(0, len, p, nullptr); +} +#endif + #if !defined(HAVE_BACKTRACE) size_t BackTrace(void**, size_t) { return 0; @@ -148,15 +148,15 @@ TResolvedSymbol ResolveSymbol(void* sym, char* buf, size_t len) { return ret; } -#elif defined(_win_) +#elif defined(_win_) #include <util/generic/singleton.h> -namespace { +namespace { struct TWinSymbolResolverImpl { typedef BOOL(WINAPI* TSymInitializeFunc)(HANDLE, PCSTR, BOOL); typedef BOOL(WINAPI* TSymCleanupFunc)(HANDLE); typedef BOOL(WINAPI* TSymFromAddrFunc)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); - + TWinSymbolResolverImpl() : InitOk(FALSE) { @@ -164,52 +164,52 @@ namespace { if (!Library) { return; } - + SymInitializeFunc = (TSymInitializeFunc)GetProcAddress(Library, "SymInitialize"); SymCleanupFunc = (TSymCleanupFunc)GetProcAddress(Library, "SymCleanup"); SymFromAddrFunc = (TSymFromAddrFunc)GetProcAddress(Library, "SymFromAddr"); if (SymInitializeFunc && SymCleanupFunc && SymFromAddrFunc) { InitOk = SymInitializeFunc(GetCurrentProcess(), nullptr, TRUE); } - } - + } + ~TWinSymbolResolverImpl() { if (InitOk) { SymCleanupFunc(GetCurrentProcess()); } - + if (Library) { FreeLibrary(Library); } - } - + } + TResolvedSymbol Resolve(void* sym, char* buf, size_t len) { TGuard<TMutex> guard(Mutex); - + TResolvedSymbol ret = { "??", sym}; - + if (!InitOk || (len <= 1 + sizeof(SYMBOL_INFO))) { return ret; } - + SYMBOL_INFO* symbol = (SYMBOL_INFO*)buf; Zero(*symbol); - + symbol->MaxNameLen = len - sizeof(SYMBOL_INFO) - 1; symbol->SizeOfStruct = sizeof(SYMBOL_INFO); - + DWORD64 displacement = 0; BOOL res = SymFromAddrFunc(GetCurrentProcess(), (DWORD64)sym, &displacement, symbol); if (res) { ret.NearestSymbol = (void*)symbol->Address; ret.Name = symbol->Name; } - + return ret; - } - + } + TMutex Mutex; HMODULE Library; TSymInitializeFunc SymInitializeFunc; @@ -217,11 +217,11 @@ namespace { TSymFromAddrFunc SymFromAddrFunc; BOOL InitOk; }; -} - -TResolvedSymbol ResolveSymbol(void* sym, char* buf, size_t len) { - return Singleton<TWinSymbolResolverImpl>()->Resolve(sym, buf, len); -} +} + +TResolvedSymbol ResolveSymbol(void* sym, char* buf, size_t len) { + return Singleton<TWinSymbolResolverImpl>()->Resolve(sym, buf, len); +} #else TResolvedSymbol ResolveSymbol(void* sym, char*, size_t) { TResolvedSymbol ret = { @@ -257,10 +257,10 @@ void FormatBackTrace(IOutputStream* out) { FormatBackTraceFn(out, array, s); } -TFormatBackTraceFn GetFormatBackTraceFn() { - return FormatBackTraceFn; -} - +TFormatBackTraceFn GetFormatBackTraceFn() { + return FormatBackTraceFn; +} + void PrintBackTrace() { FormatBackTrace(&Cerr); } diff --git a/util/system/backtrace.h b/util/system/backtrace.h index 2fce7585c3..4450644301 100644 --- a/util/system/backtrace.h +++ b/util/system/backtrace.h @@ -21,7 +21,7 @@ void PrintBackTrace(); using TFormatBackTraceFn = void (*)(IOutputStream*, void* const* backtrace, size_t backtraceSize); TFormatBackTraceFn SetFormatBackTraceFn(TFormatBackTraceFn f); -TFormatBackTraceFn GetFormatBackTraceFn(); +TFormatBackTraceFn GetFormatBackTraceFn(); using TBackTraceView = TArrayRef<void* const>; diff --git a/util/system/compiler.h b/util/system/compiler.h index b373edcc46..957cbee5bc 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -179,14 +179,14 @@ #define Y_HIDDEN #endif -#if defined(__GNUC__) +#if defined(__GNUC__) #define Y_PUBLIC __attribute__((visibility("default"))) -#endif - -#if !defined(Y_PUBLIC) +#endif + +#if !defined(Y_PUBLIC) #define Y_PUBLIC -#endif - +#endif + #if !defined(Y_UNUSED) && !defined(__cplusplus) #define Y_UNUSED(var) (void)(var) #endif diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp index b1989b5c8c..11eff0d3af 100644 --- a/util/system/shellcommand.cpp +++ b/util/system/shellcommand.cpp @@ -322,12 +322,12 @@ public: delete WatchThread; } - -#if defined(_win_) - if (Pid) { - CloseHandle(Pid); - } -#endif + +#if defined(_win_) + if (Pid) { + CloseHandle(Pid); + } +#endif } inline void AppendArgument(const TStringBuf argument) { @@ -622,7 +622,7 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { out << "Process was not created: " << LastSystemErrorText() << " command text was: '" << GetAString(cmdcopy.Data()) << "'"; } Pid = process_info.hProcess; - CloseHandle(process_info.hThread); + CloseHandle(process_info.hThread); DBG(Cerr << "created process id " << Pid << " in dir: " << cwd << ", cmd: " << cmdcopy.Data() << Endl); } #endif diff --git a/util/system/spinlock.h b/util/system/spinlock.h index af2630890a..08cc7719d8 100644 --- a/util/system/spinlock.h +++ b/util/system/spinlock.h @@ -5,8 +5,8 @@ class TSpinLockBase { protected: - inline TSpinLockBase() noexcept { - AtomicSet(Val_, 0); + inline TSpinLockBase() noexcept { + AtomicSet(Val_, 0); } public: |