diff options
author | khristich <khristich@yandex-team.ru> | 2022-02-10 16:50:11 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:11 +0300 |
commit | 4488b6dd6356a10e57c74303b91211469ab2ec34 (patch) | |
tree | c186b22d3dc57247df20942ecfb176abe093d306 /util | |
parent | eeb44fff3b21a0abc3a28ecf80df8ea214338f2a (diff) | |
download | ydb-4488b6dd6356a10e57c74303b91211469ab2ec34.tar.gz |
Restoring authorship annotation for <khristich@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/generic/hash.h | 10 | ||||
-rw-r--r-- | util/network/init.h | 6 | ||||
-rw-r--r-- | util/stream/output.cpp | 172 | ||||
-rw-r--r-- | util/stream/output.h | 4 | ||||
-rw-r--r-- | util/system/datetime.h | 4 |
5 files changed, 98 insertions, 98 deletions
diff --git a/util/generic/hash.h b/util/generic/hash.h index e46db21fa9..7a16e4f02a 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -1976,12 +1976,12 @@ public: rep.release_nodes(); } - // if (stHash != NULL) bucket_count() must be equal to stHash->bucket_count() - template <class KeySaver> + // if (stHash != NULL) bucket_count() must be equal to stHash->bucket_count() + template <class KeySaver> int save_for_st(IOutputStream* stream, KeySaver& ks, sthash<int, int, THash<int>, TEqualTo<int>, typename KeySaver::TSizeType>* stHash = nullptr) const { - return rep.template save_for_st<KeySaver>(stream, ks, stHash); - } - + return rep.template save_for_st<KeySaver>(stream, ks, stHash); + } + public: void reserve(size_type hint) { rep.reserve(hint); diff --git a/util/network/init.h b/util/network/init.h index 08a79c0fca..2e8ef4357c 100644 --- a/util/network/init.h +++ b/util/network/init.h @@ -43,9 +43,9 @@ struct sockaddr_un { #define NETDB_INTERNAL -1 #define NETDB_SUCCESS 0 -#endif - -#if defined(_win_) || defined(_darwin_) +#endif + +#if defined(_win_) || defined(_darwin_) #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 #endif diff --git a/util/stream/output.cpp b/util/stream/output.cpp index db81b81b70..98b61c2e95 100644 --- a/util/stream/output.cpp +++ b/util/stream/output.cpp @@ -8,13 +8,13 @@ #include <util/charset/utf8.h> #include <util/charset/wide.h> -#if defined(_android_) +#if defined(_android_) #include <util/system/dynlib.h> #include <util/system/guard.h> #include <util/system/mutex.h> #include <android/log.h> -#endif - +#endif + #include <cerrno> #include <string> #include <string_view> @@ -243,102 +243,102 @@ void Out<TNullPtr>(IOutputStream& o, TTypeTraits<TNullPtr>::TFuncParam) { o << TStringBuf("nullptr"); } -#if defined(_android_) +#if defined(_android_) namespace { - class TAndroidStdIOStreams { - public: - TAndroidStdIOStreams() - : LogLibrary("liblog.so") - , LogFuncPtr((TLogFuncPtr)LogLibrary.Sym("__android_log_write")) - , Out(LogFuncPtr) - , Err(LogFuncPtr) + class TAndroidStdIOStreams { + public: + TAndroidStdIOStreams() + : LogLibrary("liblog.so") + , LogFuncPtr((TLogFuncPtr)LogLibrary.Sym("__android_log_write")) + , Out(LogFuncPtr) + , Err(LogFuncPtr) { } - - public: + + public: using TLogFuncPtr = void (*)(int, const char*, const char*); - + class TAndroidStdOutput: public IOutputStream { - public: + public: inline TAndroidStdOutput(TLogFuncPtr logFuncPtr) noexcept : Buffer() , LogFuncPtr(logFuncPtr) { } - + virtual ~TAndroidStdOutput() { } - - private: - virtual void DoWrite(const void* buf, size_t len) override { + + private: + virtual void DoWrite(const void* buf, size_t len) override { with_lock (BufferMutex) { Buffer.Write(buf, len); } - } - - virtual void DoFlush() override { + } + + virtual void DoFlush() override { with_lock (BufferMutex) { LogFuncPtr(ANDROID_LOG_DEBUG, GetTag(), Buffer.Data()); Buffer.Clear(); } - } - - virtual const char* GetTag() const = 0; - - private: + } + + virtual const char* GetTag() const = 0; + + private: TMutex BufferMutex; - TStringStream Buffer; - TLogFuncPtr LogFuncPtr; - }; - + TStringStream Buffer; + TLogFuncPtr LogFuncPtr; + }; + class TStdErr: public TAndroidStdOutput { - public: - TStdErr(TLogFuncPtr logFuncPtr) - : TAndroidStdOutput(logFuncPtr) + public: + TStdErr(TLogFuncPtr logFuncPtr) + : TAndroidStdOutput(logFuncPtr) { } - + virtual ~TStdErr() { } - - private: - virtual const char* GetTag() const override { - return "stderr"; - } - }; - + + private: + virtual const char* GetTag() const override { + return "stderr"; + } + }; + class TStdOut: public TAndroidStdOutput { - public: - TStdOut(TLogFuncPtr logFuncPtr) - : TAndroidStdOutput(logFuncPtr) + public: + TStdOut(TLogFuncPtr logFuncPtr) + : TAndroidStdOutput(logFuncPtr) { } - + virtual ~TStdOut() { } - - private: - virtual const char* GetTag() const override { - return "stdout"; - } - }; - - static bool Enabled; - TDynamicLibrary LogLibrary; // field order is important, see constructor - TLogFuncPtr LogFuncPtr; - TStdOut Out; - TStdErr Err; - - static inline TAndroidStdIOStreams& Instance() { - return *SingletonWithPriority<TAndroidStdIOStreams, 4>(); - } - }; - - bool TAndroidStdIOStreams::Enabled = false; -} -#endif // _android_ - -namespace { + + private: + virtual const char* GetTag() const override { + return "stdout"; + } + }; + + static bool Enabled; + TDynamicLibrary LogLibrary; // field order is important, see constructor + TLogFuncPtr LogFuncPtr; + TStdOut Out; + TStdErr Err; + + static inline TAndroidStdIOStreams& Instance() { + return *SingletonWithPriority<TAndroidStdIOStreams, 4>(); + } + }; + + bool TAndroidStdIOStreams::Enabled = false; +} +#endif // _android_ + +namespace { class TStdOutput: public IOutputStream { public: inline TStdOutput(FILE* f) noexcept @@ -402,27 +402,27 @@ namespace { } IOutputStream& NPrivate::StdErrStream() noexcept { -#if defined(_android_) - if (TAndroidStdIOStreams::Enabled) { - return TAndroidStdIOStreams::Instance().Err; - } -#endif +#if defined(_android_) + if (TAndroidStdIOStreams::Enabled) { + return TAndroidStdIOStreams::Instance().Err; + } +#endif return TStdIOStreams::Instance().Err; } IOutputStream& NPrivate::StdOutStream() noexcept { -#if defined(_android_) - if (TAndroidStdIOStreams::Enabled) { - return TAndroidStdIOStreams::Instance().Out; - } -#endif +#if defined(_android_) + if (TAndroidStdIOStreams::Enabled) { + return TAndroidStdIOStreams::Instance().Out; + } +#endif return TStdIOStreams::Instance().Out; } - -void RedirectStdioToAndroidLog(bool redirect) { -#if defined(_android_) - TAndroidStdIOStreams::Enabled = redirect; -#else + +void RedirectStdioToAndroidLog(bool redirect) { +#if defined(_android_) + TAndroidStdIOStreams::Enabled = redirect; +#else Y_UNUSED(redirect); -#endif -} +#endif +} diff --git a/util/stream/output.h b/util/stream/output.h index 00eef50b95..61ca03dfbe 100644 --- a/util/stream/output.h +++ b/util/stream/output.h @@ -299,6 +299,6 @@ static inline void Flush(IOutputStream& o) { #include "debug.h" -void RedirectStdioToAndroidLog(bool redirect); - +void RedirectStdioToAndroidLog(bool redirect); + /** @} */ diff --git a/util/system/datetime.h b/util/system/datetime.h index aa009974e0..7e47c611af 100644 --- a/util/system/datetime.h +++ b/util/system/datetime.h @@ -79,8 +79,8 @@ Y_FORCE_INLINE ui64 GetCycleCount() noexcept { : "=A"(x)); } return x; -#elif defined(_darwin_) - return mach_absolute_time(); +#elif defined(_darwin_) + return mach_absolute_time(); #elif defined(__clang__) && !defined(_arm_) return __builtin_readcyclecounter(); #elif defined(_arm32_) |