diff options
author | fippo <fippo@yandex-team.ru> | 2022-02-10 16:50:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:08 +0300 |
commit | 7bf72dabd2102d9781c1ec7a754579757baa7b90 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util | |
parent | 3e57c324d47a3a202cb3c5a9648d2f92103d5213 (diff) | |
download | ydb-7bf72dabd2102d9781c1ec7a754579757baa7b90.tar.gz |
Restoring authorship annotation for <fippo@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/generic/queue.h | 30 | ||||
-rw-r--r-- | util/generic/utility.h | 12 | ||||
-rw-r--r-- | util/generic/utility_ut.cpp | 2 | ||||
-rw-r--r-- | util/generic/vector.h | 6 | ||||
-rw-r--r-- | util/string/split.h | 26 | ||||
-rw-r--r-- | util/string/split_ut.cpp | 12 | ||||
-rw-r--r-- | util/system/guard.h | 2 | ||||
-rw-r--r-- | util/thread/factory.cpp | 14 | ||||
-rw-r--r-- | util/thread/factory.h | 2 | ||||
-rw-r--r-- | util/thread/pool.cpp | 6 | ||||
-rw-r--r-- | util/ysaveload.h | 32 |
11 files changed, 72 insertions, 72 deletions
diff --git a/util/generic/queue.h b/util/generic/queue.h index 64d05a9efe..f5959f68f2 100644 --- a/util/generic/queue.h +++ b/util/generic/queue.h @@ -23,14 +23,14 @@ public: inline void clear() { this->c.clear(); } - - inline S& Container() { - return this->c; - } - - inline const S& Container() const { - return this->c; - } + + inline S& Container() { + return this->c; + } + + inline const S& Container() const { + return this->c; + } }; template <class T, class S, class C> @@ -48,11 +48,11 @@ public: this->c.clear(); } - inline S& Container() { - return this->c; - } - - inline const S& Container() const { - return this->c; - } + inline S& Container() { + return this->c; + } + + inline const S& Container() const { + return this->c; + } }; diff --git a/util/generic/utility.h b/util/generic/utility.h index e91a799cf1..43b98eeafc 100644 --- a/util/generic/utility.h +++ b/util/generic/utility.h @@ -11,9 +11,9 @@ static constexpr const T& Min(const T& l, const T& r) { template <typename T, typename... Args> static constexpr const T& Min(const T& a, const T& b, const Args&... args) { - return Min(a, Min(b, args...)); -} - + return Min(a, Min(b, args...)); +} + template <class T> static constexpr const T& Max(const T& l, const T& r) { return l < r ? r : l; @@ -21,9 +21,9 @@ static constexpr const T& Max(const T& l, const T& r) { template <typename T, typename... Args> static constexpr const T& Max(const T& a, const T& b, const Args&... args) { - return Max(a, Max(b, args...)); -} - + return Max(a, Max(b, args...)); +} + // replace with http://en.cppreference.com/w/cpp/algorithm/clamp in c++17 template <class T> constexpr const T& ClampVal(const T& val, const T& min, const T& max) { diff --git a/util/generic/utility_ut.cpp b/util/generic/utility_ut.cpp index c232d93822..8e9d5afff9 100644 --- a/util/generic/utility_ut.cpp +++ b/util/generic/utility_ut.cpp @@ -50,7 +50,7 @@ Y_UNIT_TEST_SUITE(TUtilityTest) { TTest j(1); DoSwap(i, j); - + UNIT_ASSERT_EQUAL(i.Val, 1); UNIT_ASSERT_EQUAL(j.Val, 0); } diff --git a/util/generic/vector.h b/util/generic/vector.h index 9af65ce700..a5b258955a 100644 --- a/util/generic/vector.h +++ b/util/generic/vector.h @@ -125,8 +125,8 @@ public: #endif inline void crop(size_type size) { - if (this->size() > size) { + if (this->size() > size) { this->erase(this->begin() + size, this->end()); - } - } + } + } }; diff --git a/util/string/split.h b/util/string/split.h index 3d7c6d1a95..bc46d9e64c 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -423,14 +423,14 @@ inline size_t Split(const TStringBuf s, const TSetDelimiter<const char>& delim, SplitString(s.data(), s.data() + s.size(), delim, consumer); return res.size(); } - + template <class P, class D> -void GetNext(TStringBuf& s, D delim, P& param) { - TStringBuf next = s.NextTok(delim); +void GetNext(TStringBuf& s, D delim, P& param) { + TStringBuf next = s.NextTok(delim); Y_ENSURE(next.IsInited(), TStringBuf("Split: number of fields less than number of Split output arguments")); - param = FromString<P>(next); -} - + param = FromString<P>(next); +} + template <class P, class D> void GetNext(TStringBuf& s, D delim, TMaybe<P>& param) { TStringBuf next = s.NextTok(delim); @@ -444,17 +444,17 @@ void GetNext(TStringBuf& s, D delim, TMaybe<P>& param) { // example: // Split(TStringBuf("Sherlock,2014,36.6"), ',', name, year, temperature); template <class D, class P1, class P2> -void Split(TStringBuf s, D delim, P1& p1, P2& p2) { - GetNext(s, delim, p1); - GetNext(s, delim, p2); +void Split(TStringBuf s, D delim, P1& p1, P2& p2) { + GetNext(s, delim, p1); + GetNext(s, delim, p2); Y_ENSURE(!s.IsInited(), TStringBuf("Split: number of fields more than number of Split output arguments")); -} - +} + template <class D, class P1, class P2, class... Other> void Split(TStringBuf s, D delim, P1& p1, P2& p2, Other&... other) { - GetNext(s, delim, p1); + GetNext(s, delim, p1); Split(s, delim, p2, other...); -} +} /** * \fn auto StringSplitter(...) diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp index e027d1ac7d..43e59f2d75 100644 --- a/util/string/split_ut.cpp +++ b/util/string/split_ut.cpp @@ -262,7 +262,7 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { UNIT_ASSERT_VALUES_EQUAL(num1, 22); UNIT_ASSERT_VALUES_EQUAL(num2, 33.5); UNIT_ASSERT_VALUES_EQUAL(strBuf, "xyz"); - } + } Y_UNIT_TEST(ConvenientSplitTestWithMaybe) { TString data("abc 42"); @@ -280,11 +280,11 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { Y_UNIT_TEST(ConvenientSplitTestExceptions) { TString data("abc 22 33"); TString s1, s2, s3, s4; - - UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2), yexception); - UNIT_ASSERT_NO_EXCEPTION(Split(data, ' ', s1, s2, s3)); - UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2, s3, s4), yexception); - } + + UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2), yexception); + UNIT_ASSERT_NO_EXCEPTION(Split(data, ' ', s1, s2, s3)); + UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2, s3, s4), yexception); + } Y_UNIT_TEST(ConvenientSplitTestMaybeExceptions) { TString data("abc 22 33"); diff --git a/util/system/guard.h b/util/system/guard.h index e8571293a1..efc091d5f8 100644 --- a/util/system/guard.h +++ b/util/system/guard.h @@ -83,7 +83,7 @@ private: private: T* T_; }; - + /* * { * auto guard = Guard(Lock_); diff --git a/util/thread/factory.cpp b/util/thread/factory.cpp index 082fe1a339..48e898f32d 100644 --- a/util/thread/factory.cpp +++ b/util/thread/factory.cpp @@ -49,7 +49,7 @@ namespace { return new TPoolThread; } }; - + class TThreadFactoryFuncObj: public IThreadFactory::IThreadAble { public: TThreadFactoryFuncObj(const std::function<void()>& func) @@ -63,17 +63,17 @@ namespace { private: std::function<void()> Func; - }; + }; } THolder<IThread> IThreadFactory::Run(std::function<void()> func) { THolder<IThread> ret(DoCreate()); - + ret->Run(new ::TThreadFactoryFuncObj(func)); - - return ret; -} - + + return ret; +} + static IThreadFactory* SystemThreadPoolImpl() { return Singleton<TSystemThreadFactory>(); } diff --git a/util/thread/factory.h b/util/thread/factory.h index 29b1aac16b..561fcbac88 100644 --- a/util/thread/factory.h +++ b/util/thread/factory.h @@ -49,7 +49,7 @@ public: // XXX: rename to Start inline THolder<IThread> Run(IThreadAble* func) { THolder<IThread> ret(DoCreate()); - + ret->Run(func); return ret; diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp index b6cb59644d..05fad02e9b 100644 --- a/util/thread/pool.cpp +++ b/util/thread/pool.cpp @@ -641,7 +641,7 @@ size_t TSimpleThreadPool::Size() const noexcept { return 0; } -namespace { +namespace { class TOwnedObjectInQueue: public IObjectInQueue { private: THolder<IObjectInQueue> Owned; @@ -657,8 +657,8 @@ namespace { Owned->Process(data); } }; -} - +} + void IThreadPool::SafeAdd(IObjectInQueue* obj) { Y_ENSURE_EX(Add(obj), TThreadPoolException() << TStringBuf("can not add object to queue")); } diff --git a/util/ysaveload.h b/util/ysaveload.h index 225579a68b..02efb4049b 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -617,28 +617,28 @@ template <class T1, class T2, class T3, class T4> class TSerializer<THashSet<T1, T2, T3, T4>>: public TSetSerializer<THashSet<T1, T2, T3, T4>, false> { }; -template <class T1, class T2> +template <class T1, class T2> class TSerializer<TQueue<T1, T2>> { -public: +public: static inline void Save(IOutputStream* rh, const TQueue<T1, T2>& v) { - ::Save(rh, v.Container()); - } + ::Save(rh, v.Container()); + } static inline void Load(IInputStream* in, TQueue<T1, T2>& t) { - ::Load(in, t.Container()); - } -}; - -template <class T1, class T2, class T3> + ::Load(in, t.Container()); + } +}; + +template <class T1, class T2, class T3> class TSerializer<TPriorityQueue<T1, T2, T3>> { -public: +public: static inline void Save(IOutputStream* rh, const TPriorityQueue<T1, T2, T3>& v) { - ::Save(rh, v.Container()); - } + ::Save(rh, v.Container()); + } static inline void Load(IInputStream* in, TPriorityQueue<T1, T2, T3>& t) { - ::Load(in, t.Container()); - } -}; - + ::Load(in, t.Container()); + } +}; + #ifndef __NVCC__ namespace NPrivate { |