aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprout <prout@yandex-team.ru>2022-02-10 16:49:42 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:42 +0300
commit7b7fa28b9099b7adca890459a699c6ba5eeff4ca (patch)
treecffe238e08f715008f864d223dd0db8fc1f92f9f
parent0fd1998e1b2369f50fb694556f817d3c7fef10c8 (diff)
downloadydb-7b7fa28b9099b7adca890459a699c6ba5eeff4ca.tar.gz
Restoring authorship annotation for <prout@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--library/cpp/coroutine/engine/cont_poller.h2
-rw-r--r--library/cpp/coroutine/engine/coroutine_ut.cpp102
-rw-r--r--library/cpp/coroutine/engine/impl.h2
-rw-r--r--library/cpp/coroutine/listener/listen.cpp222
-rw-r--r--library/cpp/coroutine/listener/listen.h36
-rw-r--r--library/cpp/digest/ya.make8
-rw-r--r--library/cpp/http/fetch/exthttpcodes.cpp2
-rw-r--r--library/cpp/http/misc/httpcodes.cpp4
-rw-r--r--library/cpp/http/misc/httpcodes.h14
-rw-r--r--library/cpp/logger/log.cpp10
-rw-r--r--util/datetime/base.h2
-rw-r--r--util/datetime/base_ut.cpp6
-rw-r--r--util/generic/intrlist.h862
-rw-r--r--util/generic/intrlist_ut.cpp12
-rw-r--r--util/generic/maybe.h84
-rw-r--r--util/generic/maybe_ut.cpp110
-rw-r--r--util/generic/singleton.h30
-rw-r--r--util/memory/tempbuf.cpp6
-rw-r--r--util/memory/tempbuf.h8
-rw-r--r--util/network/address.h6
-rw-r--r--util/network/poller.cpp8
-rw-r--r--util/network/pollerimpl.h56
-rw-r--r--util/network/socket.cpp8
-rw-r--r--util/str_stl.h4
-rw-r--r--util/stream/tempbuf.h6
-rw-r--r--util/system/guard.h20
-rw-r--r--util/system/pipe.cpp8
-rw-r--r--util/system/pipe.h4
-rw-r--r--util/system/rwlock.cpp16
-rw-r--r--util/system/thread.cpp12
-rw-r--r--util/system/thread.h12
31 files changed, 841 insertions, 841 deletions
diff --git a/library/cpp/coroutine/engine/cont_poller.h b/library/cpp/coroutine/engine/cont_poller.h
index b638b2df1a..6ae1b407bd 100644
--- a/library/cpp/coroutine/engine/cont_poller.h
+++ b/library/cpp/coroutine/engine/cont_poller.h
@@ -102,7 +102,7 @@ namespace NCoro {
struct TValue: public T, public TObjectFromPool<TValue> {
TValue() {}
};
-
+
public:
TBigArray()
: Pool_(TMemoryPool::TExpGrow::Instance(), TDefaultAllocator::Instance())
diff --git a/library/cpp/coroutine/engine/coroutine_ut.cpp b/library/cpp/coroutine/engine/coroutine_ut.cpp
index 8b372496a2..82afafcfa0 100644
--- a/library/cpp/coroutine/engine/coroutine_ut.cpp
+++ b/library/cpp/coroutine/engine/coroutine_ut.cpp
@@ -326,99 +326,99 @@ void TCoroTest::TestCondVar() {
}
namespace NCoroTestJoin {
- struct TSleepCont {
- const TInstant Deadline;
- int Result;
-
- inline void operator()(TCont* c) {
- Result = c->SleepD(Deadline);
- }
- };
-
- struct TReadCont {
- const TInstant Deadline;
- const SOCKET Sock;
- int Result;
-
- inline void operator()(TCont* c) {
- char buf = 0;
+ struct TSleepCont {
+ const TInstant Deadline;
+ int Result;
+
+ inline void operator()(TCont* c) {
+ Result = c->SleepD(Deadline);
+ }
+ };
+
+ struct TReadCont {
+ const TInstant Deadline;
+ const SOCKET Sock;
+ int Result;
+
+ inline void operator()(TCont* c) {
+ char buf = 0;
Result = NCoro::ReadD(c, Sock, &buf, sizeof(buf), Deadline).Status();
- }
- };
-
- struct TJoinCont {
- const TInstant Deadline;
- TCont* const Cont;
- bool Result;
-
- inline void operator()(TCont* c) {
- Result = c->Join(Cont, Deadline);
- }
- };
-
+ }
+ };
+
+ struct TJoinCont {
+ const TInstant Deadline;
+ TCont* const Cont;
+ bool Result;
+
+ inline void operator()(TCont* c) {
+ Result = c->Join(Cont, Deadline);
+ }
+ };
+
void DoTestJoin(EContPoller pollerType) {
auto poller = IPollerFace::Construct(pollerType);
-
+
if (!poller) {
return;
}
-
+
TContExecutor e(32000, std::move(poller));
-
+
TPipe in, out;
TPipe::Pipe(in, out);
SetNonBlock(in.GetHandle());
-
+
{
TSleepCont sc = {TInstant::Max(), 0};
TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(sc, "sc"), true};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(sc.Result, ECANCELED);
UNIT_ASSERT_EQUAL(jc.Result, false);
}
-
+
{
TSleepCont sc = {TDuration::MilliSeconds(100).ToDeadLine(), 0};
TJoinCont jc = {TDuration::MilliSeconds(200).ToDeadLine(), e.Create(sc, "sc"), false};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(sc.Result, ETIMEDOUT);
UNIT_ASSERT_EQUAL(jc.Result, true);
}
-
+
{
TSleepCont sc = {TDuration::MilliSeconds(200).ToDeadLine(), 0};
TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(sc, "sc"), true};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(sc.Result, ECANCELED);
UNIT_ASSERT_EQUAL(jc.Result, false);
}
-
+
{
TReadCont rc = {TInstant::Max(), in.GetHandle(), 0};
TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(rc, "rc"), true};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(rc.Result, ECANCELED);
UNIT_ASSERT_EQUAL(jc.Result, false);
}
-
+
{
TReadCont rc = {TDuration::MilliSeconds(100).ToDeadLine(), in.GetHandle(), 0};
TJoinCont jc = {TDuration::MilliSeconds(200).ToDeadLine(), e.Create(rc, "rc"), false};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(rc.Result, ETIMEDOUT);
UNIT_ASSERT_EQUAL(jc.Result, true);
}
-
+
{
TReadCont rc = {TDuration::MilliSeconds(200).ToDeadLine(), in.GetHandle(), 0};
TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(rc, "rc"), true};
@@ -428,9 +428,9 @@ namespace NCoroTestJoin {
UNIT_ASSERT_EQUAL(rc.Result, ECANCELED);
UNIT_ASSERT_EQUAL(jc.Result, false);
}
- }
-}
-
+ }
+}
+
void TCoroTest::TestJoinDefault() {
NCoroTestJoin::DoTestJoin(EContPoller::Default);
}
diff --git a/library/cpp/coroutine/engine/impl.h b/library/cpp/coroutine/engine/impl.h
index 283a96ecf1..53511287a3 100644
--- a/library/cpp/coroutine/engine/impl.h
+++ b/library/cpp/coroutine/engine/impl.h
@@ -104,7 +104,7 @@ public:
void SwitchTo(TExceptionSafeContext* ctx) {
Trampoline_.SwitchTo(ctx);
}
-
+
private:
void Terminate();
diff --git a/library/cpp/coroutine/listener/listen.cpp b/library/cpp/coroutine/listener/listen.cpp
index 3d4e711d1d..e047b2a423 100644
--- a/library/cpp/coroutine/listener/listen.cpp
+++ b/library/cpp/coroutine/listener/listen.cpp
@@ -10,39 +10,39 @@
using namespace NAddr;
-namespace {
- union TSa {
- const sockaddr* Sa;
- const sockaddr_in* In;
- const sockaddr_in6* In6;
-
+namespace {
+ union TSa {
+ const sockaddr* Sa;
+ const sockaddr_in* In;
+ const sockaddr_in6* In6;
+
inline TSa(const sockaddr* sa) noexcept
- : Sa(sa)
- {
- }
-
+ : Sa(sa)
+ {
+ }
+
inline bool operator==(const TSa& r) const noexcept {
- if (Sa->sa_family == r.Sa->sa_family) {
- switch (Sa->sa_family) {
+ if (Sa->sa_family == r.Sa->sa_family) {
+ switch (Sa->sa_family) {
case AF_INET:
return In->sin_port == r.In->sin_port && In->sin_addr.s_addr == r.In->sin_addr.s_addr;
case AF_INET6:
return In6->sin6_port == r.In6->sin6_port && !memcmp(&In6->sin6_addr, &r.In6->sin6_addr, sizeof(in6_addr));
- }
- }
-
- return false;
- }
-
+ }
+ }
+
+ return false;
+ }
+
inline bool operator!=(const TSa& r) const noexcept {
- return !(*this == r);
- }
- };
-}
-
+ return !(*this == r);
+ }
+ };
+}
+
class TContListener::TImpl {
-private:
- struct TStoredAddrInfo: public TAddrInfo, private TNetworkAddress {
+private:
+ struct TStoredAddrInfo: public TAddrInfo, private TNetworkAddress {
inline TStoredAddrInfo(const struct addrinfo* ai, const TNetworkAddress& addr) noexcept
: TAddrInfo(ai)
, TNetworkAddress(addr)
@@ -50,7 +50,7 @@ private:
}
};
-private:
+private:
class TOneSocketListener: public TIntrusiveListItem<TOneSocketListener> {
public:
inline TOneSocketListener(TImpl* parent, IRemoteAddrPtr addr)
@@ -88,10 +88,10 @@ private:
Stop();
}
- public:
+ public:
inline void Run(TCont* cont) noexcept {
- C_ = cont;
- DoRun();
+ C_ = cont;
+ DoRun();
C_ = nullptr;
}
@@ -127,7 +127,7 @@ private:
private:
inline void DoRun() noexcept {
- while (!C_->Cancelled()) {
+ while (!C_->Cancelled()) {
try {
TOpaqueAddr remote;
const int res = NCoro::AcceptI(C_, ListenSocket_, remote.MutableAddr(), remote.LenPtr());
@@ -164,49 +164,49 @@ private:
}
}
- try {
- Parent_->Cb_->OnStop(&ListenSocket_);
- } catch (...) {
- }
+ try {
+ Parent_->Cb_->OnStop(&ListenSocket_);
+ } catch (...) {
+ }
}
private:
- const TImpl* const Parent_;
+ const TImpl* const Parent_;
TCont* C_;
TSocketHolder ListenSocket_;
- const IRemoteAddrPtr Addr_;
+ const IRemoteAddrPtr Addr_;
};
-private:
- class TListeners: public TIntrusiveListWithAutoDelete<TOneSocketListener, TDelete> {
- private:
- template <class T>
+private:
+ class TListeners: public TIntrusiveListWithAutoDelete<TOneSocketListener, TDelete> {
+ private:
+ template <class T>
using TIt = std::conditional_t<std::is_const<T>::value, typename T::TConstIterator, typename T::TIterator>;
-
- template <class T>
+
+ template <class T>
static inline TIt<T> FindImpl(T* t, const IRemoteAddr& addr) {
- const TSa sa(addr.Addr());
-
+ const TSa sa(addr.Addr());
+
TIt<T> it = t->Begin();
TIt<T> const end = t->End();
-
- while (it != end && sa != it->Addr()->Addr()) {
- ++it;
- }
-
- return it;
- }
-
- public:
- inline TIterator Find(const IRemoteAddr& addr) {
- return FindImpl(this, addr);
- }
-
- inline TConstIterator Find(const IRemoteAddr& addr) const {
- return FindImpl(this, addr);
- }
- };
-
+
+ while (it != end && sa != it->Addr()->Addr()) {
+ ++it;
+ }
+
+ return it;
+ }
+
+ public:
+ inline TIterator Find(const IRemoteAddr& addr) {
+ return FindImpl(this, addr);
+ }
+
+ inline TConstIterator Find(const IRemoteAddr& addr) const {
+ return FindImpl(this, addr);
+ }
+ };
+
public:
inline TImpl(ICallBack* cb, TContExecutor* e, const TOptions& opts) noexcept
: E_(e)
@@ -221,18 +221,18 @@ public:
}
}
- inline void Listen(const IRemoteAddr& addr) {
- const TListeners::TIterator it = L_.Find(addr);
-
- if (it != L_.End()) {
- it->StartListen();
- }
- }
-
- inline void Bind(const IRemoteAddr& addr) {
- const TSa sa(addr.Addr());
-
- switch (sa.Sa->sa_family) {
+ inline void Listen(const IRemoteAddr& addr) {
+ const TListeners::TIterator it = L_.Find(addr);
+
+ if (it != L_.End()) {
+ it->StartListen();
+ }
+ }
+
+ inline void Bind(const IRemoteAddr& addr) {
+ const TSa sa(addr.Addr());
+
+ switch (sa.Sa->sa_family) {
case AF_INET:
L_.PushBack(new TOneSocketListener(this, MakeHolder<TIPv4Addr>(*sa.In)));
break;
@@ -241,9 +241,9 @@ public:
break;
default:
ythrow yexception() << TStringBuf("unknown protocol");
- }
- }
-
+ }
+ }
+
inline void Bind(const TIpAddress& addr) {
L_.PushBack(new TOneSocketListener(this, MakeHolder<TIPv4Addr>(addr)));
}
@@ -254,17 +254,17 @@ public:
}
}
- inline void StopListenAddr(const IRemoteAddr& addr) {
- const TListeners::TIterator it = L_.Find(addr);
+ inline void StopListenAddr(const IRemoteAddr& addr) {
+ const TListeners::TIterator it = L_.Find(addr);
- if (it != L_.End()) {
- delete &*it;
+ if (it != L_.End()) {
+ delete &*it;
}
}
private:
- TContExecutor* const E_;
- ICallBack* const Cb_;
+ TContExecutor* const E_;
+ ICallBack* const Cb_;
TListeners L_;
const TOptions Opts_;
};
@@ -285,33 +285,33 @@ namespace {
}
}
-void TContListener::Listen(const IRemoteAddr& addr) {
+void TContListener::Listen(const IRemoteAddr& addr) {
CheckImpl(Impl_)->Listen(addr);
}
-void TContListener::Listen(const TIpAddress& addr) {
- return Listen(TIPv4Addr(addr));
-}
-
-void TContListener::Listen(const TNetworkAddress& addr) {
- for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) {
- Listen(TAddrInfo(&*it));
+void TContListener::Listen(const TIpAddress& addr) {
+ return Listen(TIPv4Addr(addr));
+}
+
+void TContListener::Listen(const TNetworkAddress& addr) {
+ for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) {
+ Listen(TAddrInfo(&*it));
}
-}
+}
-void TContListener::Listen() {
+void TContListener::Listen() {
CheckImpl(Impl_)->Listen();
-}
-
-void TContListener::Bind(const IRemoteAddr& addr) {
+}
+
+void TContListener::Bind(const IRemoteAddr& addr) {
CheckImpl(Impl_)->Bind(addr);
}
-void TContListener::Bind(const TIpAddress& addr) {
- return Bind(TIPv4Addr(addr));
-}
+void TContListener::Bind(const TIpAddress& addr) {
+ return Bind(TIPv4Addr(addr));
+}
-void TContListener::Bind(const TNetworkAddress& addr) {
+void TContListener::Bind(const TNetworkAddress& addr) {
CheckImpl(Impl_)->Bind(addr);
}
@@ -319,18 +319,18 @@ void TContListener::Stop() noexcept {
Impl_.Destroy();
}
-void TContListener::StopListenAddr(const IRemoteAddr& addr) {
+void TContListener::StopListenAddr(const IRemoteAddr& addr) {
CheckImpl(Impl_)->StopListenAddr(addr);
}
-void TContListener::StopListenAddr(const TIpAddress& addr) {
- return StopListenAddr(TIPv4Addr(addr));
+void TContListener::StopListenAddr(const TIpAddress& addr) {
+ return StopListenAddr(TIPv4Addr(addr));
}
-void TContListener::StopListenAddr(const TNetworkAddress& addr) {
- for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) {
- StopListenAddr(TAddrInfo(&*it));
- }
+void TContListener::StopListenAddr(const TNetworkAddress& addr) {
+ for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) {
+ StopListenAddr(TAddrInfo(&*it));
+ }
}
void TContListener::ICallBack::OnAcceptFull(const TAcceptFull& params) {
@@ -348,7 +348,7 @@ void TContListener::ICallBack::OnAcceptFull(const TAcceptFull& params) {
}
}
-void TContListener::ICallBack::OnStop(TSocketHolder* s) {
- s->ShutDown(SHUT_RDWR);
- s->Close();
-}
+void TContListener::ICallBack::OnStop(TSocketHolder* s) {
+ s->ShutDown(SHUT_RDWR);
+ s->Close();
+}
diff --git a/library/cpp/coroutine/listener/listen.h b/library/cpp/coroutine/listener/listen.h
index 3a89cd3ecc..4193320fe3 100644
--- a/library/cpp/coroutine/listener/listen.h
+++ b/library/cpp/coroutine/listener/listen.h
@@ -86,8 +86,8 @@ public:
*/
virtual void OnError() = 0;
- virtual void OnStop(TSocketHolder*);
-
+ virtual void OnStop(TSocketHolder*);
+
virtual ~ICallBack() {
}
};
@@ -97,28 +97,28 @@ public:
/// start listener threads
void Listen();
-
- void Listen(const NAddr::IRemoteAddr& addr);
- void Listen(const TIpAddress& addr);
- void Listen(const TNetworkAddress& addr);
-
+
+ void Listen(const NAddr::IRemoteAddr& addr);
+ void Listen(const TIpAddress& addr);
+ void Listen(const TNetworkAddress& addr);
+
/// bind server on address. Can be called multiple times to bind on more then one address
- void Bind(const NAddr::IRemoteAddr& addr);
+ void Bind(const NAddr::IRemoteAddr& addr);
void Bind(const TIpAddress& addr);
void Bind(const TNetworkAddress& addr);
-
+
void Stop() noexcept;
- void StopListenAddr(const NAddr::IRemoteAddr& addr);
+ void StopListenAddr(const NAddr::IRemoteAddr& addr);
void StopListenAddr(const TIpAddress& addr);
- void StopListenAddr(const TNetworkAddress& addr);
-
- template <class T>
- inline void StartListenAddr(const T& addr) {
- Bind(addr);
- Listen(addr);
- }
-
+ void StopListenAddr(const TNetworkAddress& addr);
+
+ template <class T>
+ inline void StartListenAddr(const T& addr) {
+ Bind(addr);
+ Listen(addr);
+ }
+
private:
class TImpl;
THolder<TImpl> Impl_;
diff --git a/library/cpp/digest/ya.make b/library/cpp/digest/ya.make
index 61d4b50903..db91d932ef 100644
--- a/library/cpp/digest/ya.make
+++ b/library/cpp/digest/ya.make
@@ -1,4 +1,4 @@
-RECURSE(
+RECURSE(
argonish
argonish/benchmark
argonish/ut_fat
@@ -11,8 +11,8 @@ RECURSE(
md5/ut
md5/medium_ut
md5/bench
- murmur
- murmur/ut
+ murmur
+ murmur/ut
crc32c
crc32c/ut
old_crc
@@ -20,4 +20,4 @@ RECURSE(
old_crc/gencrc
sfh
sfh/ut
-)
+)
diff --git a/library/cpp/http/fetch/exthttpcodes.cpp b/library/cpp/http/fetch/exthttpcodes.cpp
index acc05650c8..7137dd6d15 100644
--- a/library/cpp/http/fetch/exthttpcodes.cpp
+++ b/library/cpp/http/fetch/exthttpcodes.cpp
@@ -174,7 +174,7 @@ ui16* http2status = prepare_flags(HTTP_FLAG);
TStringBuf ExtHttpCodeStr(int code) noexcept {
if (code < HTTP_CODE_MAX) {
- return HttpCodeStr(code);
+ return HttpCodeStr(code);
}
switch (code) {
case HTTP_BAD_RESPONSE_HEADER:
diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp
index ad8c80ac1e..eb4e000f7b 100644
--- a/library/cpp/http/misc/httpcodes.cpp
+++ b/library/cpp/http/misc/httpcodes.cpp
@@ -1,7 +1,7 @@
#include "httpcodes.h"
TStringBuf HttpCodeStrEx(int code) noexcept {
- switch (code) {
+ switch (code) {
case HTTP_CONTINUE:
return TStringBuf("100 Continue");
case HTTP_SWITCHING_PROTOCOLS:
@@ -137,5 +137,5 @@ TStringBuf HttpCodeStrEx(int code) noexcept {
default:
return TStringBuf("000 Unknown HTTP code");
- }
+ }
}
diff --git a/library/cpp/http/misc/httpcodes.h b/library/cpp/http/misc/httpcodes.h
index cbfbaa1188..c94c61cf37 100644
--- a/library/cpp/http/misc/httpcodes.h
+++ b/library/cpp/http/misc/httpcodes.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/generic/strbuf.h>
-
+#include <util/generic/strbuf.h>
+
enum HttpCodes {
HTTP_CONTINUE = 100,
HTTP_SWITCHING_PROTOCOLS = 101,
@@ -76,14 +76,14 @@ enum HttpCodes {
};
TStringBuf HttpCodeStrEx(int code) noexcept;
-
+
inline TStringBuf HttpCodeStr(int code) noexcept {
- return HttpCodeStrEx(code).Skip(4);
-}
-
+ return HttpCodeStrEx(code).Skip(4);
+}
+
inline bool IsHttpCode(int code) noexcept {
return HttpCodeStrEx(code).data() != HttpCodeStrEx(0).data();
-}
+}
inline bool IsUserError(int code) noexcept {
return code >= 400 && code < 500;
diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp
index e1d70cc3d2..5faaf696a7 100644
--- a/library/cpp/logger/log.cpp
+++ b/library/cpp/logger/log.cpp
@@ -69,8 +69,8 @@ public:
inline void AddLog(ELogPriority priority, const char* format, va_list args) const {
if (!IsOpen()) {
return;
- }
-
+ }
+
TPriorityLogStream ls(priority, this);
Printf(ls, format, args);
@@ -223,9 +223,9 @@ bool TLog::IsNullLog() const noexcept {
}
THolder<TLogBackend> TLog::ReleaseBackend() noexcept {
- return Impl_->ReleaseBackend();
-}
-
+ return Impl_->ReleaseBackend();
+}
+
void TLog::Write(ELogPriority priority, const char* data, size_t len) const {
if (Formatter_) {
const auto formated = Formatter_(priority, TStringBuf{data, len});
diff --git a/util/datetime/base.h b/util/datetime/base.h
index 5e902b8f63..9c2bf17336 100644
--- a/util/datetime/base.h
+++ b/util/datetime/base.h
@@ -6,7 +6,7 @@
#include <util/system/platform.h>
#include <util/system/datetime.h>
#include <util/generic/string.h>
-#include <util/generic/strbuf.h>
+#include <util/generic/strbuf.h>
#include <util/generic/ylimits.h>
#include <util/generic/utility.h>
#include <util/generic/typetraits.h>
diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp
index afc3f802eb..06c84dddbc 100644
--- a/util/datetime/base_ut.cpp
+++ b/util/datetime/base_ut.cpp
@@ -373,10 +373,10 @@ Y_UNIT_TEST_SUITE(DateTimeTest) {
Y_UNIT_TEST(TestFromString) {
static const struct T {
- const char* const Str;
- const TDuration::TValue MicroSeconds;
+ const char* const Str;
+ const TDuration::TValue MicroSeconds;
const bool Parseable;
- } tests[] = {
+ } tests[] = {
{"0", 0, true},
{"1", 1000000, true},
{"2s", 2000000, true},
diff --git a/util/generic/intrlist.h b/util/generic/intrlist.h
index b5d3f2051b..01b06c09ba 100644
--- a/util/generic/intrlist.h
+++ b/util/generic/intrlist.h
@@ -12,10 +12,10 @@ struct TIntrusiveListDefaultTag {};
*/
template <class T, class Tag = TIntrusiveListDefaultTag>
class TIntrusiveListItem {
-private:
+private:
using TListItem = TIntrusiveListItem<T, Tag>;
-public:
+public:
inline TIntrusiveListItem() noexcept
: Next_(this)
, Prev_(Next_)
@@ -23,93 +23,93 @@ public:
}
inline ~TIntrusiveListItem() {
- Unlink();
- }
+ Unlink();
+ }
-public:
+public:
Y_PURE_FUNCTION inline bool Empty() const noexcept {
- return (Prev_ == this) && (Next_ == this);
- }
+ return (Prev_ == this) && (Next_ == this);
+ }
inline void Unlink() noexcept {
- if (Empty()) {
- return;
+ if (Empty()) {
+ return;
}
- Prev_->SetNext(Next_);
- Next_->SetPrev(Prev_);
+ Prev_->SetNext(Next_);
+ Next_->SetPrev(Prev_);
- SetEnd();
- }
+ SetEnd();
+ }
inline void LinkBefore(TListItem* before) noexcept {
- Unlink();
- LinkBeforeNoUnlink(before);
- }
+ Unlink();
+ LinkBeforeNoUnlink(before);
+ }
inline void LinkBeforeNoUnlink(TListItem* before) noexcept {
- TListItem* const after = before->Prev();
+ TListItem* const after = before->Prev();
- after->SetNext(this);
- SetPrev(after);
- SetNext(before);
- before->SetPrev(this);
- }
+ after->SetNext(this);
+ SetPrev(after);
+ SetNext(before);
+ before->SetPrev(this);
+ }
inline void LinkBefore(TListItem& before) noexcept {
- LinkBefore(&before);
- }
+ LinkBefore(&before);
+ }
inline void LinkAfter(TListItem* after) noexcept {
- Unlink();
- LinkBeforeNoUnlink(after->Next());
- }
+ Unlink();
+ LinkBeforeNoUnlink(after->Next());
+ }
inline void LinkAfter(TListItem& after) noexcept {
- LinkAfter(&after);
- }
+ LinkAfter(&after);
+ }
-public:
+public:
inline TListItem* Prev() noexcept {
- return Prev_;
- }
+ return Prev_;
+ }
inline const TListItem* Prev() const noexcept {
- return Prev_;
- }
+ return Prev_;
+ }
inline TListItem* Next() noexcept {
- return Next_;
- }
+ return Next_;
+ }
inline const TListItem* Next() const noexcept {
- return Next_;
- }
+ return Next_;
+ }
-public:
+public:
inline void SetEnd() noexcept {
- Prev_ = this;
- Next_ = Prev_;
- }
+ Prev_ = this;
+ Next_ = Prev_;
+ }
inline void SetNext(TListItem* item) noexcept {
- Next_ = item;
- }
+ Next_ = item;
+ }
inline void SetPrev(TListItem* item) noexcept {
- Prev_ = item;
- }
+ Prev_ = item;
+ }
-public:
+public:
inline T* Node() noexcept {
- return static_cast<T*>(this);
- }
+ return static_cast<T*>(this);
+ }
inline const T* Node() const noexcept {
- return static_cast<const T*>(this);
- }
+ return static_cast<const T*>(this);
+ }
-private:
+private:
inline TIntrusiveListItem(const TIntrusiveListItem&) = delete;
inline TIntrusiveListItem& operator=(const TIntrusiveListItem&) = delete;
@@ -120,201 +120,201 @@ private:
template <class T, class Tag>
class TIntrusiveList {
-private:
+private:
using TListItem = TIntrusiveListItem<T, Tag>;
- template <class TListItem, class TNode>
- class TIteratorBase {
- public:
+ template <class TListItem, class TNode>
+ class TIteratorBase {
+ public:
using TItem = TListItem;
using TReference = TNode&;
using TPointer = TNode*;
-
+
using iterator_category = std::bidirectional_iterator_tag;
using difference_type = ptrdiff_t;
-
+
using value_type = TNode;
using reference = TReference;
using pointer = TPointer;
-
+
inline TIteratorBase() noexcept
- : Item_(nullptr)
+ : Item_(nullptr)
{
}
- template <class TListItem_, class TNode_>
+ template <class TListItem_, class TNode_>
inline TIteratorBase(const TIteratorBase<TListItem_, TNode_>& right) noexcept
- : Item_(right.Item())
- {
- }
+ : Item_(right.Item())
+ {
+ }
inline TIteratorBase(TItem* item) noexcept
- : Item_(item)
- {
- }
+ : Item_(item)
+ {
+ }
inline TItem* Item() const noexcept {
- return Item_;
- }
+ return Item_;
+ }
inline void Next() noexcept {
- Item_ = Item_->Next();
- }
+ Item_ = Item_->Next();
+ }
inline void Prev() noexcept {
- Item_ = Item_->Prev();
- }
+ Item_ = Item_->Prev();
+ }
- template <class TListItem_, class TNode_>
+ template <class TListItem_, class TNode_>
inline bool operator==(const TIteratorBase<TListItem_, TNode_>& right) const noexcept {
- return Item() == right.Item();
- }
+ return Item() == right.Item();
+ }
- template <class TListItem_, class TNode_>
+ template <class TListItem_, class TNode_>
inline bool operator!=(const TIteratorBase<TListItem_, TNode_>& right) const noexcept {
- return Item() != right.Item();
- }
+ return Item() != right.Item();
+ }
inline TIteratorBase& operator++() noexcept {
- Next();
+ Next();
- return *this;
- }
+ return *this;
+ }
inline TIteratorBase operator++(int) noexcept {
TIteratorBase ret(*this);
- Next();
+ Next();
- return ret;
- }
+ return ret;
+ }
inline TIteratorBase& operator--() noexcept {
- Prev();
+ Prev();
- return *this;
- }
+ return *this;
+ }
inline TIteratorBase operator--(int) noexcept {
TIteratorBase ret(*this);
- Prev();
+ Prev();
- return ret;
- }
+ return ret;
+ }
inline TReference operator*() const noexcept {
- return *Item_->Node();
- }
+ return *Item_->Node();
+ }
inline TPointer operator->() const noexcept {
- return Item_->Node();
- }
+ return Item_->Node();
+ }
- private:
+ private:
TItem* Item_;
- };
+ };
- template <class TIterator>
- class TReverseIteratorBase {
- public:
+ template <class TIterator>
+ class TReverseIteratorBase {
+ public:
using TItem = typename TIterator::TItem;
using TReference = typename TIterator::TReference;
using TPointer = typename TIterator::TPointer;
-
+
using iterator_category = typename TIterator::iterator_category;
using difference_type = typename TIterator::difference_type;
-
+
using value_type = typename TIterator::value_type;
using reference = typename TIterator::reference;
using pointer = typename TIterator::pointer;
-
+
inline TReverseIteratorBase() noexcept = default;
- template <class TIterator_>
+ template <class TIterator_>
inline TReverseIteratorBase(const TReverseIteratorBase<TIterator_>& right) noexcept
- : Current_(right.Base())
- {
- }
+ : Current_(right.Base())
+ {
+ }
inline explicit TReverseIteratorBase(TIterator item) noexcept
- : Current_(item)
- {
- }
-
+ : Current_(item)
+ {
+ }
+
inline TIterator Base() const noexcept {
- return Current_;
- }
-
+ return Current_;
+ }
+
inline TItem* Item() const noexcept {
- TIterator ret = Current_;
-
- return (--ret).Item();
- }
+ TIterator ret = Current_;
+ return (--ret).Item();
+ }
+
inline void Next() noexcept {
- Current_.Prev();
- }
-
+ Current_.Prev();
+ }
+
inline void Prev() noexcept {
- Current_.Next();
- }
-
- template <class TIterator_>
+ Current_.Next();
+ }
+
+ template <class TIterator_>
inline bool operator==(const TReverseIteratorBase<TIterator_>& right) const noexcept {
- return Base() == right.Base();
- }
-
- template <class TIterator_>
+ return Base() == right.Base();
+ }
+
+ template <class TIterator_>
inline bool operator!=(const TReverseIteratorBase<TIterator_>& right) const noexcept {
- return Base() != right.Base();
- }
-
+ return Base() != right.Base();
+ }
+
inline TReverseIteratorBase& operator++() noexcept {
- Next();
+ Next();
- return *this;
- }
+ return *this;
+ }
inline TReverseIteratorBase operator++(int) noexcept {
TReverseIteratorBase ret(*this);
- Next();
+ Next();
- return ret;
- }
+ return ret;
+ }
inline TReverseIteratorBase& operator--() noexcept {
- Prev();
+ Prev();
- return *this;
- }
+ return *this;
+ }
inline TReverseIteratorBase operator--(int) noexcept {
TReverseIteratorBase ret(*this);
- Prev();
+ Prev();
- return ret;
- }
+ return ret;
+ }
inline TReference operator*() const noexcept {
- TIterator ret = Current_;
-
- return *--ret;
- }
+ TIterator ret = Current_;
+ return *--ret;
+ }
+
inline TPointer operator->() const noexcept {
- TIterator ret = Current_;
-
- return &*--ret;
- }
+ TIterator ret = Current_;
- private:
- TIterator Current_;
- };
+ return &*--ret;
+ }
+
+ private:
+ TIterator Current_;
+ };
-public:
+public:
using TIterator = TIteratorBase<TListItem, T>;
using TConstIterator = TIteratorBase<const TListItem, const T>;
@@ -326,28 +326,28 @@ public:
using reverse_iterator = TReverseIterator;
using const_reverse_iterator = TConstReverseIterator;
-
-public:
+
+public:
inline void Swap(TIntrusiveList& right) noexcept {
- TIntrusiveList temp;
+ TIntrusiveList temp;
- temp.Append(right);
+ temp.Append(right);
Y_ASSERT(right.Empty());
- right.Append(*this);
+ right.Append(*this);
Y_ASSERT(this->Empty());
- this->Append(temp);
+ this->Append(temp);
Y_ASSERT(temp.Empty());
- }
+ }
-public:
+public:
inline TIntrusiveList() noexcept = default;
-
+
inline ~TIntrusiveList() = default;
inline TIntrusiveList(TIntrusiveList&& right) noexcept {
- this->Swap(right);
- }
-
+ this->Swap(right);
+ }
+
inline TIntrusiveList& operator=(TIntrusiveList&& rhs) noexcept {
this->Swap(rhs);
return *this;
@@ -358,235 +358,235 @@ public:
}
Y_PURE_FUNCTION inline bool Empty() const noexcept {
- return End_.Empty();
- }
+ return End_.Empty();
+ }
inline size_t Size() const noexcept {
return std::distance(Begin(), End());
- }
+ }
inline void Remove(TListItem* item) noexcept {
item->Unlink();
}
inline void Clear() noexcept {
- End_.Unlink();
- }
+ End_.Unlink();
+ }
-public:
+public:
inline TIterator Begin() noexcept {
- return ++End();
- }
+ return ++End();
+ }
inline TIterator End() noexcept {
return TIterator(&End_);
- }
+ }
inline TConstIterator Begin() const noexcept {
- return ++End();
- }
+ return ++End();
+ }
inline TConstIterator End() const noexcept {
return TConstIterator(&End_);
- }
+ }
inline TReverseIterator RBegin() noexcept {
return TReverseIterator(End());
- }
+ }
inline TReverseIterator REnd() noexcept {
return TReverseIterator(Begin());
- }
+ }
inline TConstReverseIterator RBegin() const noexcept {
return TConstReverseIterator(End());
- }
+ }
inline TConstReverseIterator REnd() const noexcept {
return TConstReverseIterator(Begin());
- }
+ }
inline TConstIterator CBegin() const noexcept {
- return Begin();
- }
-
+ return Begin();
+ }
+
inline TConstIterator CEnd() const noexcept {
- return End();
- }
-
+ return End();
+ }
+
inline TConstReverseIterator CRBegin() const noexcept {
- return RBegin();
- }
-
+ return RBegin();
+ }
+
inline TConstReverseIterator CREnd() const noexcept {
- return REnd();
- }
-
-public:
+ return REnd();
+ }
+
+public:
inline iterator begin() noexcept {
- return Begin();
- }
-
+ return Begin();
+ }
+
inline iterator end() noexcept {
- return End();
- }
-
+ return End();
+ }
+
inline const_iterator begin() const noexcept {
- return Begin();
- }
-
+ return Begin();
+ }
+
inline const_iterator end() const noexcept {
- return End();
- }
-
+ return End();
+ }
+
inline reverse_iterator rbegin() noexcept {
- return RBegin();
- }
-
+ return RBegin();
+ }
+
inline reverse_iterator rend() noexcept {
- return REnd();
- }
-
+ return REnd();
+ }
+
inline const_iterator cbegin() const noexcept {
- return CBegin();
- }
-
+ return CBegin();
+ }
+
inline const_iterator cend() const noexcept {
- return CEnd();
- }
-
+ return CEnd();
+ }
+
inline const_reverse_iterator crbegin() const noexcept {
- return CRBegin();
- }
-
+ return CRBegin();
+ }
+
inline const_reverse_iterator crend() const noexcept {
- return CREnd();
- }
-
-public:
+ return CREnd();
+ }
+
+public:
inline T* Back() noexcept {
- return End_.Prev()->Node();
- }
-
+ return End_.Prev()->Node();
+ }
+
inline T* Front() noexcept {
- return End_.Next()->Node();
- }
-
+ return End_.Next()->Node();
+ }
+
inline const T* Back() const noexcept {
- return End_.Prev()->Node();
- }
-
+ return End_.Prev()->Node();
+ }
+
inline const T* Front() const noexcept {
- return End_.Next()->Node();
- }
-
+ return End_.Next()->Node();
+ }
+
inline void PushBack(TListItem* item) noexcept {
- item->LinkBefore(End_);
- }
+ item->LinkBefore(End_);
+ }
inline void PushFront(TListItem* item) noexcept {
- item->LinkAfter(End_);
- }
+ item->LinkAfter(End_);
+ }
inline T* PopBack() noexcept {
- TListItem* const ret = End_.Prev();
+ TListItem* const ret = End_.Prev();
- ret->Unlink();
+ ret->Unlink();
- return ret->Node();
- }
+ return ret->Node();
+ }
inline T* PopFront() noexcept {
- TListItem* const ret = End_.Next();
+ TListItem* const ret = End_.Next();
- ret->Unlink();
+ ret->Unlink();
- return ret->Node();
- }
+ return ret->Node();
+ }
inline void Append(TIntrusiveList& list) noexcept {
- Cut(list.Begin(), list.End(), End());
- }
-
+ Cut(list.Begin(), list.End(), End());
+ }
+
inline static void Cut(TIterator begin, TIterator end, TIterator pasteBefore) noexcept {
- if (begin == end) {
- return;
+ if (begin == end) {
+ return;
}
- TListItem* const cutFront = begin.Item();
- TListItem* const gapBack = end.Item();
+ TListItem* const cutFront = begin.Item();
+ TListItem* const gapBack = end.Item();
- TListItem* const gapFront = cutFront->Prev();
- TListItem* const cutBack = gapBack->Prev();
+ TListItem* const gapFront = cutFront->Prev();
+ TListItem* const cutBack = gapBack->Prev();
- gapFront->SetNext(gapBack);
- gapBack->SetPrev(gapFront);
+ gapFront->SetNext(gapBack);
+ gapBack->SetPrev(gapFront);
- TListItem* const pasteBack = pasteBefore.Item();
- TListItem* const pasteFront = pasteBack->Prev();
+ TListItem* const pasteBack = pasteBefore.Item();
+ TListItem* const pasteFront = pasteBack->Prev();
- pasteFront->SetNext(cutFront);
- cutFront->SetPrev(pasteFront);
+ pasteFront->SetNext(cutFront);
+ cutFront->SetPrev(pasteFront);
- cutBack->SetNext(pasteBack);
- pasteBack->SetPrev(cutBack);
- }
+ cutBack->SetNext(pasteBack);
+ pasteBack->SetPrev(cutBack);
+ }
-public:
- template <class TFunctor>
+public:
+ template <class TFunctor>
inline void ForEach(TFunctor&& functor) {
- TIterator i = Begin();
+ TIterator i = Begin();
- while (i != End()) {
- functor(&*(i++));
- }
- }
+ while (i != End()) {
+ functor(&*(i++));
+ }
+ }
- template <class TFunctor>
+ template <class TFunctor>
inline void ForEach(TFunctor&& functor) const {
- TConstIterator i = Begin();
+ TConstIterator i = Begin();
- while (i != End()) {
- functor(&*(i++));
+ while (i != End()) {
+ functor(&*(i++));
}
- }
+ }
- template <class TComparer>
+ template <class TComparer>
inline void QuickSort(TComparer&& comparer) {
- if (Begin() == End() || ++Begin() == End()) {
- return;
- }
-
- T* const pivot = PopFront();
- TIntrusiveList bigger;
- TIterator i = Begin();
-
- while (i != End()) {
- if (comparer(*pivot, *i)) {
- bigger.PushBack(&*i++);
- } else {
- ++i;
+ if (Begin() == End() || ++Begin() == End()) {
+ return;
+ }
+
+ T* const pivot = PopFront();
+ TIntrusiveList bigger;
+ TIterator i = Begin();
+
+ while (i != End()) {
+ if (comparer(*pivot, *i)) {
+ bigger.PushBack(&*i++);
+ } else {
+ ++i;
}
- }
+ }
- this->QuickSort(comparer);
- bigger.QuickSort(comparer);
+ this->QuickSort(comparer);
+ bigger.QuickSort(comparer);
- PushBack(pivot);
- Append(bigger);
- }
+ PushBack(pivot);
+ Append(bigger);
+ }
-private:
+private:
inline TIntrusiveList(const TIntrusiveList&) = delete;
inline TIntrusiveList& operator=(const TIntrusiveList&) = delete;
private:
- TListItem End_;
+ TListItem End_;
};
template <class T, class D, class Tag>
class TIntrusiveListWithAutoDelete: public TIntrusiveList<T, Tag> {
-public:
+public:
using TIterator = typename TIntrusiveList<T, Tag>::TIterator;
using TConstIterator = typename TIntrusiveList<T, Tag>::TConstIterator;
@@ -598,39 +598,39 @@ public:
using reverse_iterator = TReverseIterator;
using const_reverse_iterator = TConstReverseIterator;
-
-public:
+
+public:
inline TIntrusiveListWithAutoDelete() noexcept = default;
-
+
inline TIntrusiveListWithAutoDelete(TIntrusiveListWithAutoDelete&& right) noexcept
: TIntrusiveList<T, Tag>(std::move(right))
- {
- }
-
+ {
+ }
+
inline ~TIntrusiveListWithAutoDelete() {
- this->Clear();
- }
-
+ this->Clear();
+ }
+
TIntrusiveListWithAutoDelete& operator=(TIntrusiveListWithAutoDelete&& rhs) noexcept {
TIntrusiveList<T, Tag>::operator=(std::move(rhs));
return *this;
}
-public:
+public:
inline void Clear() noexcept {
this->ForEach([](auto* item) {
D::Destroy(item);
});
- }
+ }
inline static void Cut(TIterator begin, TIterator end) noexcept {
TIntrusiveListWithAutoDelete<T, D, Tag> temp;
- Cut(begin, end, temp.End());
- }
-
+ Cut(begin, end, temp.End());
+ }
+
inline static void Cut(TIterator begin, TIterator end, TIterator pasteBefore) noexcept {
TIntrusiveList<T, Tag>::Cut(begin, end, pasteBefore);
- }
+ }
};
/*
@@ -638,54 +638,54 @@ public:
*/
template <class T, class Tag = TIntrusiveListDefaultTag>
class TIntrusiveSListItem {
-private:
+private:
using TListItem = TIntrusiveSListItem<T, Tag>;
-public:
+public:
inline TIntrusiveSListItem() noexcept
- : Next_(nullptr)
+ : Next_(nullptr)
{
- }
+ }
inline ~TIntrusiveSListItem() = default;
inline bool IsEnd() const noexcept {
- return Next_ == nullptr;
+ return Next_ == nullptr;
}
inline TListItem* Next() noexcept {
- return Next_;
- }
+ return Next_;
+ }
inline const TListItem* Next() const noexcept {
- return Next_;
- }
+ return Next_;
+ }
inline void SetNext(TListItem* item) noexcept {
- Next_ = item;
- }
+ Next_ = item;
+ }
-public:
+public:
inline T* Node() noexcept {
- return static_cast<T*>(this);
- }
+ return static_cast<T*>(this);
+ }
inline const T* Node() const noexcept {
- return static_cast<const T*>(this);
- }
+ return static_cast<const T*>(this);
+ }
-private:
+private:
TListItem* Next_;
};
template <class T, class Tag>
class TIntrusiveSList {
-private:
+private:
using TListItem = TIntrusiveSListItem<T, Tag>;
-public:
- template <class TListItem, class TNode>
- class TIteratorBase {
+public:
+ template <class TListItem, class TNode>
+ class TIteratorBase {
public:
using TItem = TListItem;
using TReference = TNode&;
@@ -698,175 +698,175 @@ public:
using iterator_category = std::forward_iterator_tag;
inline TIteratorBase(TListItem* item) noexcept
- : Item_(item)
- {
- }
+ : Item_(item)
+ {
+ }
inline void Next() noexcept {
- Item_ = Item_->Next();
- }
+ Item_ = Item_->Next();
+ }
inline bool operator==(const TIteratorBase& right) const noexcept {
- return Item_ == right.Item_;
- }
+ return Item_ == right.Item_;
+ }
inline bool operator!=(const TIteratorBase& right) const noexcept {
- return Item_ != right.Item_;
- }
+ return Item_ != right.Item_;
+ }
inline TIteratorBase& operator++() noexcept {
- Next();
+ Next();
- return *this;
- }
+ return *this;
+ }
inline TIteratorBase operator++(int) noexcept {
- TIteratorBase ret(*this);
+ TIteratorBase ret(*this);
- Next();
+ Next();
- return ret;
- }
+ return ret;
+ }
inline TNode& operator*() noexcept {
- return *Item_->Node();
- }
+ return *Item_->Node();
+ }
inline TNode* operator->() noexcept {
- return Item_->Node();
- }
+ return Item_->Node();
+ }
- private:
+ private:
TListItem* Item_;
- };
+ };
-public:
+public:
using TIterator = TIteratorBase<TListItem, T>;
using TConstIterator = TIteratorBase<const TListItem, const T>;
using iterator = TIterator;
using const_iterator = TConstIterator;
-public:
+public:
inline TIntrusiveSList() noexcept
- : Begin_(nullptr)
+ : Begin_(nullptr)
{
- }
+ }
inline void Swap(TIntrusiveSList& right) noexcept {
DoSwap(Begin_, right.Begin_);
- }
+ }
inline explicit operator bool() const noexcept {
return !Empty();
}
Y_PURE_FUNCTION inline bool Empty() const noexcept {
- return Begin_ == nullptr;
- }
+ return Begin_ == nullptr;
+ }
inline size_t Size() const noexcept {
return std::distance(Begin(), End());
- }
+ }
inline void Clear() noexcept {
- Begin_ = nullptr;
- }
+ Begin_ = nullptr;
+ }
inline TIterator Begin() noexcept {
return TIterator(Begin_);
- }
+ }
inline TIterator End() noexcept {
- return TIterator(nullptr);
- }
+ return TIterator(nullptr);
+ }
inline TConstIterator Begin() const noexcept {
return TConstIterator(Begin_);
- }
+ }
inline TConstIterator End() const noexcept {
- return TConstIterator(nullptr);
- }
+ return TConstIterator(nullptr);
+ }
inline TConstIterator CBegin() const noexcept {
- return Begin();
- }
-
+ return Begin();
+ }
+
inline TConstIterator CEnd() const noexcept {
- return End();
- }
-
+ return End();
+ }
+
//compat methods
inline iterator begin() noexcept {
- return Begin();
- }
-
+ return Begin();
+ }
+
inline iterator end() noexcept {
- return End();
- }
-
+ return End();
+ }
+
inline const_iterator begin() const noexcept {
- return Begin();
- }
-
+ return Begin();
+ }
+
inline const_iterator end() const noexcept {
- return End();
- }
-
+ return End();
+ }
+
inline const_iterator cbegin() const noexcept {
- return CBegin();
- }
-
+ return CBegin();
+ }
+
inline const_iterator cend() const noexcept {
- return CEnd();
- }
-
+ return CEnd();
+ }
+
inline T* Front() noexcept {
Y_ASSERT(Begin_);
- return Begin_->Node();
- }
-
+ return Begin_->Node();
+ }
+
inline const T* Front() const noexcept {
Y_ASSERT(Begin_);
- return Begin_->Node();
- }
-
+ return Begin_->Node();
+ }
+
inline void PushFront(TListItem* item) noexcept {
- item->SetNext(Begin_);
- Begin_ = item;
- }
+ item->SetNext(Begin_);
+ Begin_ = item;
+ }
inline T* PopFront() noexcept {
Y_ASSERT(Begin_);
- TListItem* const ret = Begin_;
- Begin_ = Begin_->Next();
-
- return ret->Node();
- }
+ TListItem* const ret = Begin_;
+ Begin_ = Begin_->Next();
+ return ret->Node();
+ }
+
inline void Reverse() noexcept {
- TIntrusiveSList temp;
-
- while (!Empty()) {
- temp.PushFront(PopFront());
+ TIntrusiveSList temp;
+
+ while (!Empty()) {
+ temp.PushFront(PopFront());
}
- this->Swap(temp);
- }
+ this->Swap(temp);
+ }
- template <class TFunctor>
+ template <class TFunctor>
inline void ForEach(TFunctor&& functor) const noexcept(noexcept(functor(std::declval<TListItem>().Node()))) {
- TListItem* i = Begin_;
+ TListItem* i = Begin_;
- while (i) {
- TListItem* const next = i->Next();
- functor(i->Node());
- i = next;
+ while (i) {
+ TListItem* const next = i->Next();
+ functor(i->Node());
+ i = next;
}
- }
+ }
-private:
+private:
TListItem* Begin_;
};
diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp
index eff7cdf2ee..25892b9cab 100644
--- a/util/generic/intrlist_ut.cpp
+++ b/util/generic/intrlist_ut.cpp
@@ -95,9 +95,9 @@ public:
}
};
-struct TIntGreater: private TGreater<int> {
+struct TIntGreater: private TGreater<int> {
inline bool operator()(const TInt& l, const TInt& r) const noexcept {
- return TGreater<int>::operator()(l, r);
+ return TGreater<int>::operator()(l, r);
}
};
@@ -105,7 +105,7 @@ void TListTest::TestQuickSort() {
TMyList l(1000);
size_t c = 0;
- l.QuickSort(TIntGreater());
+ l.QuickSort(TIntGreater());
UNIT_ASSERT_EQUAL(l.Size(), 1000);
@@ -137,9 +137,9 @@ void TListTest::TestRIterate() {
TMyList l(1000);
size_t c = 1000;
- UNIT_ASSERT_EQUAL(l.RBegin(), TMyList::TReverseIterator(l.End()));
- UNIT_ASSERT_EQUAL(l.REnd(), TMyList::TReverseIterator(l.Begin()));
-
+ UNIT_ASSERT_EQUAL(l.RBegin(), TMyList::TReverseIterator(l.End()));
+ UNIT_ASSERT_EQUAL(l.REnd(), TMyList::TReverseIterator(l.Begin()));
+
for (TMyList::TReverseIterator it = l.RBegin(); it != l.REnd(); ++it) {
UNIT_ASSERT_EQUAL(*it, (int)c--);
}
diff --git a/util/generic/maybe.h b/util/generic/maybe.h
index 34d21aebcd..6a1a048bc6 100644
--- a/util/generic/maybe.h
+++ b/util/generic/maybe.h
@@ -233,11 +233,11 @@ public:
template <class U = T>
std::enable_if_t<TAssignableFromAny<U>::value, TMaybe&> operator=(U&& right) {
- if (Defined()) {
+ if (Defined()) {
*Data() = std::forward<U>(right);
- } else {
+ } else {
Init(std::forward<U>(right));
- }
+ }
return *this;
}
@@ -245,7 +245,7 @@ public:
std::enable_if_t<TCopyAssignable<U>::value,
TMaybe&>
operator=(const TMaybe<U, Policy>& right) {
- if (right.Defined()) {
+ if (right.Defined()) {
if (Defined()) {
*Data() = right.GetRef();
} else {
@@ -285,44 +285,44 @@ public:
}
void Clear() noexcept {
- if (Defined()) {
+ if (Defined()) {
this->Defined_ = false;
Data()->~T();
- }
+ }
}
constexpr bool Defined() const noexcept {
return this->Defined_;
- }
+ }
Y_PURE_FUNCTION constexpr bool Empty() const noexcept {
- return !Defined();
+ return !Defined();
}
void CheckDefined() const {
if (Y_UNLIKELY(!Defined())) {
Policy::OnEmpty(typeid(TValueType));
- }
- }
-
+ }
+ }
+
const T* Get() const noexcept {
return Defined() ? Data() : nullptr;
- }
-
+ }
+
T* Get() noexcept {
return Defined() ? Data() : nullptr;
- }
-
+ }
+
constexpr const T& GetRef() const& {
CheckDefined();
- return *Data();
+ return *Data();
}
constexpr T& GetRef() & {
CheckDefined();
- return *Data();
+ return *Data();
}
constexpr const T&& GetRef() const&& {
@@ -338,11 +338,11 @@ public:
}
constexpr const T& operator*() const& {
- return GetRef();
- }
+ return GetRef();
+ }
constexpr T& operator*() & {
- return GetRef();
+ return GetRef();
}
constexpr const T&& operator*() const&& {
@@ -354,29 +354,29 @@ public:
}
constexpr const T* operator->() const {
- return &GetRef();
+ return &GetRef();
}
constexpr T* operator->() {
- return &GetRef();
- }
-
+ return &GetRef();
+ }
+
constexpr const T& GetOrElse(const T& elseValue) const {
- return Defined() ? *Data() : elseValue;
- }
-
+ return Defined() ? *Data() : elseValue;
+ }
+
constexpr T& GetOrElse(T& elseValue) {
- return Defined() ? *Data() : elseValue;
- }
-
+ return Defined() ? *Data() : elseValue;
+ }
+
constexpr const TMaybe& OrElse(const TMaybe& elseValue) const noexcept {
- return Defined() ? *this : elseValue;
- }
-
+ return Defined() ? *this : elseValue;
+ }
+
constexpr TMaybe& OrElse(TMaybe& elseValue) {
- return Defined() ? *this : elseValue;
- }
-
+ return Defined() ? *this : elseValue;
+ }
+
template <typename U>
TMaybe<U, Policy> Cast() const {
return Defined() ? TMaybe<U, Policy>(*Data()) : TMaybe<U, Policy>();
@@ -432,20 +432,20 @@ public:
Swap(other);
}
-private:
+private:
constexpr const T* Data() const noexcept {
return std::addressof(this->Data_);
- }
-
+ }
+
constexpr T* Data() noexcept {
return std::addressof(this->Data_);
- }
-
+ }
+
template <typename... Args>
void Init(Args&&... args) {
new (Data()) T(std::forward<Args>(args)...);
this->Defined_ = true;
- }
+ }
};
template <class T>
diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp
index 2c1a425c5e..59e17a687a 100644
--- a/util/generic/maybe_ut.cpp
+++ b/util/generic/maybe_ut.cpp
@@ -8,16 +8,16 @@
class TIncrementOnDestroy {
private:
int* Ptr_;
-
+
public:
TIncrementOnDestroy(int* ptr) noexcept
: Ptr_(ptr)
- {
+ {
}
-
+
~TIncrementOnDestroy() {
++*Ptr_;
- }
+ }
};
Y_UNIT_TEST_SUITE(TMaybeTest) {
@@ -54,80 +54,80 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
}
Y_UNIT_TEST(TTestConstructorDestructor) {
- int a = 0;
- int b = 0;
+ int a = 0;
+ int b = 0;
TMaybe<TIncrementOnDestroy>();
- UNIT_ASSERT_VALUES_EQUAL(a, b);
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
- TMaybe<TIncrementOnDestroy>(TIncrementOnDestroy(&a));
- b += 2;
- UNIT_ASSERT_VALUES_EQUAL(a, b);
+ TMaybe<TIncrementOnDestroy>(TIncrementOnDestroy(&a));
+ b += 2;
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
{
- TMaybe<TIncrementOnDestroy> m1 = TIncrementOnDestroy(&a);
- b += 1;
- UNIT_ASSERT_VALUES_EQUAL(a, b);
+ TMaybe<TIncrementOnDestroy> m1 = TIncrementOnDestroy(&a);
+ b += 1;
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
- TMaybe<TIncrementOnDestroy> m2 = m1;
- UNIT_ASSERT_VALUES_EQUAL(a, b);
+ TMaybe<TIncrementOnDestroy> m2 = m1;
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
- TMaybe<TIncrementOnDestroy> m3;
- m3 = m1;
- UNIT_ASSERT_VALUES_EQUAL(a, b);
+ TMaybe<TIncrementOnDestroy> m3;
+ m3 = m1;
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
}
- b += 3;
- UNIT_ASSERT_VALUES_EQUAL(a, b);
+ b += 3;
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
{
- TMaybe<TIncrementOnDestroy> m4 = TIncrementOnDestroy(&a);
- b += 1;
- UNIT_ASSERT_VALUES_EQUAL(a, b);
-
- m4 = TIncrementOnDestroy(&a);
- b += 1;
- UNIT_ASSERT_VALUES_EQUAL(a, b);
-
- m4.Clear();
- b += 1;
- UNIT_ASSERT_VALUES_EQUAL(a, b);
-
- m4.Clear();
- UNIT_ASSERT_VALUES_EQUAL(a, b);
+ TMaybe<TIncrementOnDestroy> m4 = TIncrementOnDestroy(&a);
+ b += 1;
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
+
+ m4 = TIncrementOnDestroy(&a);
+ b += 1;
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
+
+ m4.Clear();
+ b += 1;
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
+
+ m4.Clear();
+ UNIT_ASSERT_VALUES_EQUAL(a, b);
}
}
Y_UNIT_TEST(TestAssignmentClear) {
- TMaybe<int> m5;
- UNIT_ASSERT(!m5.Defined());
- UNIT_ASSERT(m5.Empty());
- UNIT_ASSERT(m5 == TMaybe<int>());
+ TMaybe<int> m5;
+ UNIT_ASSERT(!m5.Defined());
+ UNIT_ASSERT(m5.Empty());
+ UNIT_ASSERT(m5 == TMaybe<int>());
UNIT_ASSERT(m5 == Nothing());
- UNIT_ASSERT(m5 != TMaybe<int>(4));
+ UNIT_ASSERT(m5 != TMaybe<int>(4));
- m5 = 4;
+ m5 = 4;
- UNIT_ASSERT(m5.Defined());
- UNIT_ASSERT(!m5.Empty());
+ UNIT_ASSERT(m5.Defined());
+ UNIT_ASSERT(!m5.Empty());
- UNIT_ASSERT_VALUES_EQUAL(4, m5.GetRef());
- UNIT_ASSERT(m5 == TMaybe<int>(4));
- UNIT_ASSERT(m5 != TMaybe<int>(3));
- UNIT_ASSERT(m5 != TMaybe<int>());
+ UNIT_ASSERT_VALUES_EQUAL(4, m5.GetRef());
+ UNIT_ASSERT(m5 == TMaybe<int>(4));
+ UNIT_ASSERT(m5 != TMaybe<int>(3));
+ UNIT_ASSERT(m5 != TMaybe<int>());
UNIT_ASSERT(m5 != Nothing());
- m5 = TMaybe<int>(5);
- UNIT_ASSERT(m5.Defined());
- UNIT_ASSERT_VALUES_EQUAL(5, m5.GetRef());
- UNIT_ASSERT(m5 == TMaybe<int>(5));
- UNIT_ASSERT(m5 != TMaybe<int>(4));
+ m5 = TMaybe<int>(5);
+ UNIT_ASSERT(m5.Defined());
+ UNIT_ASSERT_VALUES_EQUAL(5, m5.GetRef());
+ UNIT_ASSERT(m5 == TMaybe<int>(5));
+ UNIT_ASSERT(m5 != TMaybe<int>(4));
- m5 = TMaybe<int>();
- UNIT_ASSERT(m5.Empty());
- UNIT_ASSERT(m5 == TMaybe<int>());
+ m5 = TMaybe<int>();
+ UNIT_ASSERT(m5.Empty());
+ UNIT_ASSERT(m5 == TMaybe<int>());
UNIT_ASSERT(m5 == Nothing());
- UNIT_ASSERT(m5 != TMaybe<int>(5));
+ UNIT_ASSERT(m5 != TMaybe<int>(5));
m5 = 4;
m5 = Nothing();
diff --git a/util/generic/singleton.h b/util/generic/singleton.h
index f5fa047f5c..ab6ff59879 100644
--- a/util/generic/singleton.h
+++ b/util/generic/singleton.h
@@ -56,7 +56,7 @@ namespace NPrivate {
return ret;
}
-
+
template <class T, size_t P, class... TArgs>
T* SingletonInt(TArgs&&... args) {
static_assert(sizeof(T) < 32000, "use HugeSingleton instead");
@@ -71,22 +71,22 @@ namespace NPrivate {
return ret;
}
- template <class T>
- class TDefault {
- public:
+ template <class T>
+ class TDefault {
+ public:
template <class... TArgs>
inline TDefault(TArgs&&... args)
: T_(std::forward<TArgs>(args)...)
- {
- }
-
+ {
+ }
+
inline const T* Get() const noexcept {
- return &T_;
- }
-
- private:
- T T_;
- };
+ return &T_;
+ }
+
+ private:
+ T T_;
+ };
template <class T>
struct THeapStore {
@@ -130,7 +130,7 @@ T* HugeSingletonWithPriority(TArgs&&... args) {
return SingletonWithPriority<::NPrivate::THeapStore<T>, P>(std::forward<TArgs>(args)...)->D;
}
-template <class T>
-const T& Default() {
+template <class T>
+const T& Default() {
return *(::NPrivate::SingletonInt<typename ::NPrivate::TDefault<T>, TSingletonTraits<T>::Priority>()->Get());
}
diff --git a/util/memory/tempbuf.cpp b/util/memory/tempbuf.cpp
index 09a2d0f140..d67aeac7bb 100644
--- a/util/memory/tempbuf.cpp
+++ b/util/memory/tempbuf.cpp
@@ -236,9 +236,9 @@ char* TTempBuf::Current() noexcept {
}
const char* TTempBuf::Current() const noexcept {
- return Data() + Filled();
-}
-
+ return Data() + Filled();
+}
+
size_t TTempBuf::Filled() const noexcept {
return Impl_->Filled();
}
diff --git a/util/memory/tempbuf.h b/util/memory/tempbuf.h
index 334670eb1e..226c9c0aaa 100644
--- a/util/memory/tempbuf.h
+++ b/util/memory/tempbuf.h
@@ -68,7 +68,7 @@ private:
public:
TTempArray() = default;
-
+
TTempArray(size_t len)
: TTempBuf(RawSize(len))
{
@@ -77,11 +77,11 @@ public:
T* Data() noexcept {
return TypedPointer(TTempBuf::Data());
}
-
+
const T* Data() const noexcept {
return TypedPointer(TTempBuf::Data());
}
-
+
T* Current() noexcept {
return TypedPointer(TTempBuf::Current());
}
@@ -89,7 +89,7 @@ public:
const T* Current() const noexcept {
return TypedPointer(TTempBuf::Current());
}
-
+
size_t Size() const noexcept {
return TypedSize(TTempBuf::Size());
}
diff --git a/util/network/address.h b/util/network/address.h
index 448fcac0c9..47e20fb2a2 100644
--- a/util/network/address.h
+++ b/util/network/address.h
@@ -91,7 +91,7 @@ namespace NAddr {
}
private:
- const addrinfo* const AI_;
+ const addrinfo* const AI_;
};
//compat, for TIpAddress
@@ -111,7 +111,7 @@ namespace NAddr {
}
private:
- const TIpAddress A_;
+ const TIpAddress A_;
};
//same, for ipv6 addresses
@@ -131,6 +131,6 @@ namespace NAddr {
}
private:
- const sockaddr_in6 A_;
+ const sockaddr_in6 A_;
};
}
diff --git a/util/network/poller.cpp b/util/network/poller.cpp
index 7954d0e8b5..932d5c4071 100644
--- a/util/network/poller.cpp
+++ b/util/network/poller.cpp
@@ -49,10 +49,10 @@ void TSocketPoller::WaitWrite(SOCKET sock, void* cookie) {
Impl_->Set(cookie, sock, CONT_POLL_WRITE);
}
-void TSocketPoller::WaitReadWrite(SOCKET sock, void* cookie) {
- Impl_->Set(cookie, sock, CONT_POLL_READ | CONT_POLL_WRITE);
-}
-
+void TSocketPoller::WaitReadWrite(SOCKET sock, void* cookie) {
+ Impl_->Set(cookie, sock, CONT_POLL_READ | CONT_POLL_WRITE);
+}
+
void TSocketPoller::WaitRdhup(SOCKET sock, void* cookie) {
Impl_->Set(cookie, sock, CONT_POLL_RDHUP);
}
diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h
index e8c7e40fba..7bc6900289 100644
--- a/util/network/pollerimpl.h
+++ b/util/network/pollerimpl.h
@@ -160,29 +160,29 @@ public:
}
static inline int ExtractStatus(const TEvent* event) noexcept {
- if (event->flags & EV_ERROR) {
- return EIO;
- }
-
+ if (event->flags & EV_ERROR) {
+ return EIO;
+ }
+
return event->fflags;
}
static inline int ExtractFilterImpl(const TEvent* event) noexcept {
if (event->filter == EVFILT_READ) {
- return CONT_POLL_READ;
- }
-
- if (event->filter == EVFILT_WRITE) {
- return CONT_POLL_WRITE;
- }
+ return CONT_POLL_READ;
+ }
+ if (event->filter == EVFILT_WRITE) {
+ return CONT_POLL_WRITE;
+ }
+
if (event->flags & EV_EOF) {
return CONT_POLL_READ | CONT_POLL_WRITE;
}
- return 0;
- }
-
+ return 0;
+ }
+
private:
int Fd_;
};
@@ -287,23 +287,23 @@ public:
}
static inline int ExtractFilterImpl(const TEvent* event) noexcept {
- int ret = 0;
-
- if (event->events & EPOLLIN) {
- ret |= CONT_POLL_READ;
- }
-
- if (event->events & EPOLLOUT) {
- ret |= CONT_POLL_WRITE;
- }
-
+ int ret = 0;
+
+ if (event->events & EPOLLIN) {
+ ret |= CONT_POLL_READ;
+ }
+
+ if (event->events & EPOLLOUT) {
+ ret |= CONT_POLL_WRITE;
+ }
+
if (event->events & EPOLLRDHUP) {
ret |= CONT_POLL_RDHUP;
}
- return ret;
- }
-
+ return ret;
+ }
+
private:
int Fd_;
};
@@ -585,8 +585,8 @@ public:
static inline int ExtractFilterImpl(const TEvent* event) noexcept {
return event->Filter();
- }
-
+ }
+
private:
inline void Signal() noexcept {
char ch = 13;
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 4f6e804346..bd7d2dd867 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -1008,7 +1008,7 @@ public:
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
-
+
hints.ai_flags = flags;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
@@ -1071,9 +1071,9 @@ TNetworkAddress::TNetworkAddress(const TUnixSocketPath& unixSocketPath, int flag
TNetworkAddress::TNetworkAddress(const TString& host, ui16 port, int flags)
: Impl_(new TImpl(host.data(), port, flags))
-{
-}
-
+{
+}
+
TNetworkAddress::TNetworkAddress(const TString& host, ui16 port)
: Impl_(new TImpl(host.data(), port, 0))
{
diff --git a/util/str_stl.h b/util/str_stl.h
index f1e137181d..cd0321ee1a 100644
--- a/util/str_stl.h
+++ b/util/str_stl.h
@@ -254,8 +254,8 @@ struct TLess<TUtf32String>: public TLess<TUtf32StringBuf> {
template <class T>
struct TGreater: public std::greater<T> {
-};
-
+};
+
template <>
struct TGreater<TString>: public TGreater<TStringBuf> {
using is_transparent = void;
diff --git a/util/stream/tempbuf.h b/util/stream/tempbuf.h
index a6dc001025..caebc3add8 100644
--- a/util/stream/tempbuf.h
+++ b/util/stream/tempbuf.h
@@ -9,13 +9,13 @@ public:
inline TTempBufOutput() = default;
explicit TTempBufOutput(size_t size)
- : TTempBuf(size)
+ : TTempBuf(size)
{
}
-
+
TTempBufOutput(TTempBufOutput&&) noexcept = default;
TTempBufOutput& operator=(TTempBufOutput&&) noexcept = default;
protected:
void DoWrite(const void* data, size_t len) override;
-};
+};
diff --git a/util/system/guard.h b/util/system/guard.h
index efc091d5f8..0bb93f0b88 100644
--- a/util/system/guard.h
+++ b/util/system/guard.h
@@ -21,19 +21,19 @@ struct TTryLockOps: public TCommonLockOps<T> {
};
//must be used with great care
-template <class TOps>
+template <class TOps>
struct TInverseLockOps: public TOps {
- template <class T>
+ template <class T>
static inline void Acquire(T* t) noexcept {
- TOps::Release(t);
- }
-
- template <class T>
+ TOps::Release(t);
+ }
+
+ template <class T>
static inline void Release(T* t) noexcept {
- TOps::Acquire(t);
- }
-};
-
+ TOps::Acquire(t);
+ }
+};
+
template <class T, class TOps = TCommonLockOps<T>>
class TGuard: public TNonCopyable {
public:
diff --git a/util/system/pipe.cpp b/util/system/pipe.cpp
index a543bd7472..1d098e8966 100644
--- a/util/system/pipe.cpp
+++ b/util/system/pipe.cpp
@@ -98,7 +98,7 @@ public:
return Handle_;
}
- size_t Read(void* buffer, size_t count) const {
+ size_t Read(void* buffer, size_t count) const {
ssize_t r = Handle_.Read(buffer, count);
if (r < 0) {
ythrow TFileError() << "failed to read from pipe";
@@ -106,7 +106,7 @@ public:
return r;
}
- size_t Write(const void* buffer, size_t count) const {
+ size_t Write(const void* buffer, size_t count) const {
ssize_t r = Handle_.Write(buffer, count);
if (r < 0) {
ythrow TFileError() << "failed to write to pipe";
@@ -142,11 +142,11 @@ bool TPipe::IsOpen() const noexcept {
return Impl_->IsOpen();
}
-size_t TPipe::Read(void* buf, size_t len) const {
+size_t TPipe::Read(void* buf, size_t len) const {
return Impl_->Read(buf, len);
}
-size_t TPipe::Write(const void* buf, size_t len) const {
+size_t TPipe::Write(const void* buf, size_t len) const {
return Impl_->Write(buf, len);
}
diff --git a/util/system/pipe.h b/util/system/pipe.h
index 75d0360049..c56dd1b4ae 100644
--- a/util/system/pipe.h
+++ b/util/system/pipe.h
@@ -73,8 +73,8 @@ public:
bool IsOpen() const noexcept;
PIPEHANDLE GetHandle() const noexcept;
- size_t Read(void* buf, size_t len) const;
- size_t Write(const void* buf, size_t len) const;
+ size_t Read(void* buf, size_t len) const;
+ size_t Write(const void* buf, size_t len) const;
// Only CloseOnExec is supported
static void Pipe(TPipe& reader, TPipe& writer, EOpenMode mode = 0);
diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp
index bb3dcbf188..a4ac69fad6 100644
--- a/util/system/rwlock.cpp
+++ b/util/system/rwlock.cpp
@@ -171,44 +171,44 @@ TRWMutex::TImpl::TImpl() {
}
TRWMutex::TImpl::~TImpl() {
- const int result = pthread_rwlock_destroy(&Lock_);
+ const int result = pthread_rwlock_destroy(&Lock_);
Y_VERIFY(result == 0, "rwlock destroy failed (%s)", LastSystemErrorText(result));
}
void TRWMutex::TImpl::AcquireRead() noexcept {
- const int result = pthread_rwlock_rdlock(&Lock_);
+ const int result = pthread_rwlock_rdlock(&Lock_);
Y_VERIFY(result == 0, "rwlock rdlock failed (%s)", LastSystemErrorText(result));
}
bool TRWMutex::TImpl::TryAcquireRead() noexcept {
- const int result = pthread_rwlock_tryrdlock(&Lock_);
+ const int result = pthread_rwlock_tryrdlock(&Lock_);
Y_VERIFY(result == 0 || result == EBUSY, "rwlock tryrdlock failed (%s)", LastSystemErrorText(result));
return result == 0;
}
void TRWMutex::TImpl::ReleaseRead() noexcept {
- const int result = pthread_rwlock_unlock(&Lock_);
+ const int result = pthread_rwlock_unlock(&Lock_);
Y_VERIFY(result == 0, "rwlock (read) unlock failed (%s)", LastSystemErrorText(result));
}
void TRWMutex::TImpl::AcquireWrite() noexcept {
- const int result = pthread_rwlock_wrlock(&Lock_);
+ const int result = pthread_rwlock_wrlock(&Lock_);
Y_VERIFY(result == 0, "rwlock wrlock failed (%s)", LastSystemErrorText(result));
}
bool TRWMutex::TImpl::TryAcquireWrite() noexcept {
- const int result = pthread_rwlock_trywrlock(&Lock_);
+ const int result = pthread_rwlock_trywrlock(&Lock_);
Y_VERIFY(result == 0 || result == EBUSY, "rwlock trywrlock failed (%s)", LastSystemErrorText(result));
return result == 0;
}
void TRWMutex::TImpl::ReleaseWrite() noexcept {
- const int result = pthread_rwlock_unlock(&Lock_);
+ const int result = pthread_rwlock_unlock(&Lock_);
Y_VERIFY(result == 0, "rwlock (write) unlock failed (%s)", LastSystemErrorText(result));
}
void TRWMutex::TImpl::Release() noexcept {
- const int result = pthread_rwlock_unlock(&Lock_);
+ const int result = pthread_rwlock_unlock(&Lock_);
Y_VERIFY(result == 0, "rwlock unlock failed (%s)", LastSystemErrorText(result));
}
diff --git a/util/system/thread.cpp b/util/system/thread.cpp
index 6236746c2d..2d32e9ee8f 100644
--- a/util/system/thread.cpp
+++ b/util/system/thread.cpp
@@ -355,18 +355,18 @@ TThread::TId TThread::CurrentThreadNumericId() noexcept {
TThread::TId TThread::ImpossibleThreadId() noexcept {
return Max<TThread::TId>();
}
-
-namespace {
+
+namespace {
template <class T>
static void* ThreadProcWrapper(void* param) {
return reinterpret_cast<T*>(param)->ThreadProc();
}
-}
-
+}
+
ISimpleThread::ISimpleThread(size_t stackSize)
: TThread(TParams(ThreadProcWrapper<ISimpleThread>, reinterpret_cast<void*>(this), stackSize))
-{
-}
+{
+}
#if defined(_MSC_VER)
// This beautiful piece of code is borrowed from
diff --git a/util/system/thread.h b/util/system/thread.h
index a6e8abdb5b..3040ca59de 100644
--- a/util/system/thread.h
+++ b/util/system/thread.h
@@ -28,7 +28,7 @@ public:
void* StackPointer;
// See comments for `SetCurrentThreadName`
TString Name = GetProgramName();
-
+
inline TParams()
: Proc(nullptr)
, Data(nullptr)
@@ -36,7 +36,7 @@ public:
, StackPointer(nullptr)
{
}
-
+
inline TParams(TThreadProc proc, void* data)
: Proc(proc)
, Data(data)
@@ -156,15 +156,15 @@ private:
class TImpl;
THolder<TImpl> Impl_;
};
-
+
class ISimpleThread: public TThread {
public:
ISimpleThread(size_t stackSize = 0);
-
+
virtual ~ISimpleThread() = default;
-
+
virtual void* ThreadProc() = 0;
-};
+};
struct TCurrentThreadLimits {
TCurrentThreadLimits() noexcept;