aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authoralex-sh <alex-sh@yandex-team.ru>2022-02-10 16:50:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:03 +0300
commit88ee78b1a163eaddee7e880ac73943456040fce0 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util
parent3196904c9f5bf7aff7374eeadcb0671589581f61 (diff)
downloadydb-88ee78b1a163eaddee7e880ac73943456040fce0.tar.gz
Restoring authorship annotation for <alex-sh@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/generic/algorithm.h22
-rw-r--r--util/generic/hash.h4
-rw-r--r--util/generic/strbuf.h138
-rw-r--r--util/generic/strbuf_ut.cpp14
-rw-r--r--util/network/interface.cpp8
-rw-r--r--util/thread/pool.cpp14
-rw-r--r--util/thread/pool.h2
7 files changed, 101 insertions, 101 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h
index 86e8583047..badfb88993 100644
--- a/util/generic/algorithm.h
+++ b/util/generic/algorithm.h
@@ -469,34 +469,34 @@ template <typename C, typename Val>
Val Accumulate(const C& c, Val val) {
// std::move since C++20
return Accumulate(std::begin(c), std::end(c), std::move(val));
-}
-
+}
+
template <typename C, typename Val, typename BinOp>
Val Accumulate(const C& c, Val val, BinOp binOp) {
// std::move since C++20
return Accumulate(std::begin(c), std::end(c), std::move(val), binOp);
-}
-
+}
+
template <typename It1, typename It2, typename Val>
static inline Val InnerProduct(It1 begin1, It1 end1, It2 begin2, Val val) {
return std::inner_product(begin1, end1, begin2, val);
}
template <typename It1, typename It2, typename Val, typename BinOp1, typename BinOp2>
-static inline Val InnerProduct(It1 begin1, It1 end1, It2 begin2, Val val, BinOp1 binOp1, BinOp2 binOp2) {
+static inline Val InnerProduct(It1 begin1, It1 end1, It2 begin2, Val val, BinOp1 binOp1, BinOp2 binOp2) {
return std::inner_product(begin1, end1, begin2, val, binOp1, binOp2);
-}
-
+}
+
template <typename TVectorType>
static inline typename TVectorType::value_type InnerProduct(const TVectorType& lhs, const TVectorType& rhs, typename TVectorType::value_type val = typename TVectorType::value_type()) {
return std::inner_product(lhs.begin(), lhs.end(), rhs.begin(), val);
-}
-
+}
+
template <typename TVectorType, typename BinOp1, typename BinOp2>
static inline typename TVectorType::value_type InnerProduct(const TVectorType& lhs, const TVectorType& rhs, typename TVectorType::value_type val, BinOp1 binOp1, BinOp2 binOp2) {
return std::inner_product(lhs.begin(), lhs.end(), rhs.begin(), val, binOp1, binOp2);
-}
-
+}
+
template <class T>
static inline T MinElement(T begin, T end) {
return std::min_element(begin, end);
diff --git a/util/generic/hash.h b/util/generic/hash.h
index ef3aae78e7..e46db21fa9 100644
--- a/util/generic/hash.h
+++ b/util/generic/hash.h
@@ -1345,7 +1345,7 @@ void THashTable<V, K, HF, Ex, Eq, A>::basic_clear() {
if (!num_elements) {
return;
}
-
+
node** first = buckets.begin();
node** last = buckets.end();
for (; first < last; ++first) {
@@ -1358,7 +1358,7 @@ void THashTable<V, K, HF, Ex, Eq, A>::basic_clear() {
}
*first = nullptr;
}
- }
+ }
num_elements = 0;
}
diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h
index c5e194de46..70b9360d58 100644
--- a/util/generic/strbuf.h
+++ b/util/generic/strbuf.h
@@ -215,8 +215,8 @@ public:
*/
inline bool TrySplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept {
return TrySplitOn(TBase::find(delim), l, r, delim.size());
- }
-
+ }
+
/**
* Tries to split string in two parts using given delimiter sequence.
* Searches for the delimiter, scanning string from the end.
@@ -230,31 +230,31 @@ public:
*/
inline bool TryRSplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept {
return TrySplitOn(TBase::rfind(delim), l, r, delim.size());
- }
-
+ }
+
inline void Split(TCharType delim, TdSelf& l, TdSelf& r) const noexcept {
- SplitTemplate(delim, l, r);
+ SplitTemplate(delim, l, r);
}
inline void RSplit(TCharType delim, TdSelf& l, TdSelf& r) const noexcept {
- RSplitTemplate(delim, l, r);
+ RSplitTemplate(delim, l, r);
}
inline void Split(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept {
- SplitTemplate(delim, l, r);
- }
-
+ SplitTemplate(delim, l, r);
+ }
+
inline void RSplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept {
- RSplitTemplate(delim, l, r);
- }
-
+ RSplitTemplate(delim, l, r);
+ }
+
private:
// splits on a delimiter at a given position; delimiter is excluded
void DoSplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len) const noexcept {
Y_ASSERT(pos != TBase::npos);
// make a copy in case one of l/r is really *this
- const TdSelf tok = SubStr(pos + len);
+ const TdSelf tok = SubStr(pos + len);
l = Head(pos);
r = tok;
}
@@ -271,7 +271,7 @@ public:
if (TBase::npos == pos)
return false;
- DoSplitOn(pos, l, r, len);
+ DoSplitOn(pos, l, r, len);
return true;
}
@@ -390,21 +390,21 @@ public:
}
bool NextTok(TCharType delim, TdSelf& tok) {
- return NextTokTemplate(delim, tok);
- }
+ return NextTokTemplate(delim, tok);
+ }
bool NextTok(TdSelf delim, TdSelf& tok) {
- return NextTokTemplate(delim, tok);
- }
+ return NextTokTemplate(delim, tok);
+ }
bool RNextTok(TCharType delim, TdSelf& tok) {
- return RNextTokTemplate(delim, tok);
+ return RNextTokTemplate(delim, tok);
}
bool RNextTok(TdSelf delim, TdSelf& tok) {
- return RNextTokTemplate(delim, tok);
- }
-
+ return RNextTokTemplate(delim, tok);
+ }
+
bool ReadLine(TdSelf& tok) {
if (NextTok('\n', tok)) {
while (!tok.empty() && tok.back() == '\r') {
@@ -418,20 +418,20 @@ public:
}
TdSelf NextTok(TCharType delim) {
- return NextTokTemplate(delim);
+ return NextTokTemplate(delim);
}
TdSelf RNextTok(TCharType delim) {
- return RNextTokTemplate(delim);
+ return RNextTokTemplate(delim);
}
TdSelf NextTok(TdSelf delim) {
- return NextTokTemplate(delim);
- }
-
+ return NextTokTemplate(delim);
+ }
+
TdSelf RNextTok(TdSelf delim) {
- return RNextTokTemplate(delim);
- }
+ return RNextTokTemplate(delim);
+ }
public: // string subsequences
/// Cut last @c shift characters (or less if length is less than @c shift)
@@ -487,53 +487,53 @@ public: // string subsequences
}
private:
- template <typename TDelimiterType>
- TdSelf NextTokTemplate(TDelimiterType delim) {
- TdSelf tok;
- Split(delim, tok, *this);
- return tok;
- }
-
- template <typename TDelimiterType>
- TdSelf RNextTokTemplate(TDelimiterType delim) {
- TdSelf tok;
- RSplit(delim, *this, tok);
- return tok;
- }
-
- template <typename TDelimiterType>
- bool NextTokTemplate(TDelimiterType delim, TdSelf& tok) {
+ template <typename TDelimiterType>
+ TdSelf NextTokTemplate(TDelimiterType delim) {
+ TdSelf tok;
+ Split(delim, tok, *this);
+ return tok;
+ }
+
+ template <typename TDelimiterType>
+ TdSelf RNextTokTemplate(TDelimiterType delim) {
+ TdSelf tok;
+ RSplit(delim, *this, tok);
+ return tok;
+ }
+
+ template <typename TDelimiterType>
+ bool NextTokTemplate(TDelimiterType delim, TdSelf& tok) {
if (!empty()) {
- tok = NextTokTemplate(delim);
- return true;
- }
- return false;
- }
-
- template <typename TDelimiterType>
- bool RNextTokTemplate(TDelimiterType delim, TdSelf& tok) {
+ tok = NextTokTemplate(delim);
+ return true;
+ }
+ return false;
+ }
+
+ template <typename TDelimiterType>
+ bool RNextTokTemplate(TDelimiterType delim, TdSelf& tok) {
if (!empty()) {
tok = RNextTokTemplate(delim);
- return true;
- }
- return false;
- }
-
- template <typename TDelimiterType>
+ return true;
+ }
+ return false;
+ }
+
+ template <typename TDelimiterType>
inline void SplitTemplate(TDelimiterType delim, TdSelf& l, TdSelf& r) const noexcept {
if (!TrySplit(delim, l, r)) {
- l = *this;
- r = TdSelf();
- }
- }
-
- template <typename TDelimiterType>
+ l = *this;
+ r = TdSelf();
+ }
+ }
+
+ template <typename TDelimiterType>
inline void RSplitTemplate(TDelimiterType delim, TdSelf& l, TdSelf& r) const noexcept {
if (!TryRSplit(delim, l, r)) {
- r = *this;
- l = TdSelf();
- }
- }
+ r = *this;
+ l = TdSelf();
+ }
+ }
};
std::ostream& operator<<(std::ostream& os, TStringBuf buf);
diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp
index dd55ec5fba..69cde785af 100644
--- a/util/generic/strbuf_ut.cpp
+++ b/util/generic/strbuf_ut.cpp
@@ -186,23 +186,23 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
}
Y_UNIT_TEST(TestNextStringTok) {
- TStringBuf buf1("a@@b@@c");
+ TStringBuf buf1("a@@b@@c");
UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("a"));
UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("b"));
UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("c"));
- UNIT_ASSERT_EQUAL(buf1, TStringBuf());
-
- TStringBuf buf2("a@@b@@c");
+ UNIT_ASSERT_EQUAL(buf1, TStringBuf());
+
+ TStringBuf buf2("a@@b@@c");
UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("c"));
UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("b"));
UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("a"));
- UNIT_ASSERT_EQUAL(buf2, TStringBuf());
+ UNIT_ASSERT_EQUAL(buf2, TStringBuf());
TStringBuf buf3("a@@b@@c");
UNIT_ASSERT_EQUAL(buf3.RNextTok("@@@"), TStringBuf("a@@b@@c"));
UNIT_ASSERT_EQUAL(buf3, TStringBuf());
- }
-
+ }
+
Y_UNIT_TEST(TestReadLine) {
TStringBuf buf("12\n45\r\n\r\n23");
TStringBuf tok;
diff --git a/util/network/interface.cpp b/util/network/interface.cpp
index ba22e9e2a9..256776c6d3 100644
--- a/util/network/interface.cpp
+++ b/util/network/interface.cpp
@@ -41,17 +41,17 @@ namespace NAddr {
for (IP_ADAPTER_UNICAST_ADDRESS* addr = ptr->FirstUnicastAddress; addr != 0; addr = addr->Next) {
sockaddr* a = (sockaddr*)addr->Address.lpSockaddr;
if (IsInetAddress(a)) {
- TNetworkInterface networkInterface;
+ TNetworkInterface networkInterface;
// Not very efficient but straightforward
for (size_t i = 0; ptr->FriendlyName[i] != 0; i++) {
CHAR w = ptr->FriendlyName[i];
char c = (w < 0x80) ? char(w) : '?';
- networkInterface.Name.append(1, c);
+ networkInterface.Name.append(1, c);
}
- networkInterface.Address = new TOpaqueAddr(a);
- result.push_back(networkInterface);
+ networkInterface.Address = new TOpaqueAddr(a);
+ result.push_back(networkInterface);
}
}
}
diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp
index 6a7ad9c2cc..05fad02e9b 100644
--- a/util/thread/pool.cpp
+++ b/util/thread/pool.cpp
@@ -759,14 +759,14 @@ namespace {
IThread* IThreadPool::DoCreate() {
return new TPoolThread(this);
}
-
+
THolder<IThreadPool> CreateThreadPool(size_t threadsCount, size_t queueSizeLimit, const TThreadPoolParams& params) {
THolder<IThreadPool> queue;
- if (threadsCount > 1) {
+ if (threadsCount > 1) {
queue.Reset(new TThreadPool(params));
- } else {
+ } else {
queue.Reset(new TFakeThreadPool());
- }
- queue->Start(threadsCount, queueSizeLimit);
- return queue;
-}
+ }
+ queue->Start(threadsCount, queueSizeLimit);
+ return queue;
+}
diff --git a/util/thread/pool.h b/util/thread/pool.h
index ffcdb13860..d1ea3a67cb 100644
--- a/util/thread/pool.h
+++ b/util/thread/pool.h
@@ -382,7 +382,7 @@ inline void Delete(THolder<IThreadPool> q) {
q->Stop();
}
}
-
+
/**
* Creates and starts TThreadPool if threadsCount > 1, or TFakeThreadPool otherwise
* You could specify blocking and catching modes for TThreadPool only