aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorilezhankin <ilezhankin@yandex-team.ru>2022-02-10 16:45:55 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:55 +0300
commit1d125034f06575234f83f24f08677955133f140e (patch)
treeec05fbbd61dc118d5de37f206ab978cff58774bd /util
parent3a7a498715ef1b66f5054455421b845e45e3a653 (diff)
downloadydb-1d125034f06575234f83f24f08677955133f140e.tar.gz
Restoring authorship annotation for <ilezhankin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/digest/ya.make4
-rw-r--r--util/folder/path.cpp34
-rw-r--r--util/folder/path.h6
-rw-r--r--util/network/sock.h44
-rw-r--r--util/network/socket.h10
-rw-r--r--util/random/entropy.cpp18
-rw-r--r--util/random/entropy.h4
-rw-r--r--util/random/random.cpp14
-rw-r--r--util/random/random.h10
9 files changed, 72 insertions, 72 deletions
diff --git a/util/digest/ya.make b/util/digest/ya.make
index e378a7e419..43dd6a8763 100644
--- a/util/digest/ya.make
+++ b/util/digest/ya.make
@@ -1,7 +1,7 @@
OWNER(g:util)
SUBSCRIBER(g:util-subscribers)
-
-PROVIDES(cityhash)
+
+PROVIDES(cityhash)
RECURSE(
benchmark
diff --git a/util/folder/path.cpp b/util/folder/path.cpp
index bfe0c67d68..a8b3a4535a 100644
--- a/util/folder/path.cpp
+++ b/util/folder/path.cpp
@@ -258,23 +258,23 @@ void TFsPath::ListNames(TVector<TString>& children) const {
}
}
-bool TFsPath::Contains(const TString& component) const {
- if (!IsDefined()) {
- return false;
- }
-
- TFsPath path = *this;
- while (path.Parent() != path) {
- if (path.GetName() == component) {
- return true;
- }
-
- path = path.Parent();
- }
-
- return false;
-}
-
+bool TFsPath::Contains(const TString& component) const {
+ if (!IsDefined()) {
+ return false;
+ }
+
+ TFsPath path = *this;
+ while (path.Parent() != path) {
+ if (path.GetName() == component) {
+ return true;
+ }
+
+ path = path.Parent();
+ }
+
+ return false;
+}
+
void TFsPath::List(TVector<TFsPath>& files) const {
TVector<TString> names;
ListNames(names);
diff --git a/util/folder/path.h b/util/folder/path.h
index 2fb4d6b4ef..74785492dd 100644
--- a/util/folder/path.h
+++ b/util/folder/path.h
@@ -155,9 +155,9 @@ public:
void List(TVector<TFsPath>& children) const;
void ListNames(TVector<TString>& children) const;
- // Check, if path contains at least one component with a specific name.
- bool Contains(const TString& component) const;
-
+ // Check, if path contains at least one component with a specific name.
+ bool Contains(const TString& component) const;
+
// fails to delete non-empty directory
void DeleteIfExists() const;
// delete recursively. Does nothing if not exists
diff --git a/util/network/sock.h b/util/network/sock.h
index b10be2f715..88835bd676 100644
--- a/util/network/sock.h
+++ b/util/network/sock.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/folder/path.h>
+#include <util/folder/path.h>
#include <util/system/defaults.h>
#include <util/string/cast.h>
#include <util/stream/output.h>
@@ -89,10 +89,10 @@ struct TSockAddrLocal: public ISockAddr {
return TString(Path);
}
- TFsPath ToPath() const {
- return TFsPath(Path);
- }
-
+ TFsPath ToPath() const {
+ return TFsPath(Path);
+ }
+
int ResolveAddr() const {
if (in.sin_port == 0) {
int ret = 0;
@@ -182,10 +182,10 @@ struct TSockAddrLocal: public sockaddr_un, public ISockAddr {
return TString(sun_path);
}
- TFsPath ToPath() const {
- return TFsPath(sun_path);
- }
-
+ TFsPath ToPath() const {
+ return TFsPath(sun_path);
+ }
+
int Bind(SOCKET s, ui16 mode) const override {
(void)unlink(sun_path);
@@ -405,7 +405,7 @@ public:
class TStreamSocket: public TBaseSocket {
protected:
- explicit TStreamSocket(SOCKET fd)
+ explicit TStreamSocket(SOCKET fd)
: TBaseSocket(fd)
{
}
@@ -413,9 +413,9 @@ protected:
public:
TStreamSocket()
: TBaseSocket(INVALID_SOCKET)
- {
- }
-
+ {
+ }
+
ssize_t Send(const void* msg, size_t len, int flags = 0) {
const ssize_t ret = send((SOCKET) * this, (const char*)msg, (int)len, flags);
if (ret < 0)
@@ -452,15 +452,15 @@ public:
return ret;
}
- int Accept(TStreamSocket* acceptedSock, ISockAddr* acceptedAddr = nullptr) {
- SOCKET s = INVALID_SOCKET;
- if (acceptedAddr) {
- socklen_t acceptedSize = acceptedAddr->Size();
- s = accept((SOCKET) * this, acceptedAddr->SockAddr(), &acceptedSize);
- } else {
- s = accept((SOCKET) * this, nullptr, nullptr);
- }
-
+ int Accept(TStreamSocket* acceptedSock, ISockAddr* acceptedAddr = nullptr) {
+ SOCKET s = INVALID_SOCKET;
+ if (acceptedAddr) {
+ socklen_t acceptedSize = acceptedAddr->Size();
+ s = accept((SOCKET) * this, acceptedAddr->SockAddr(), &acceptedSize);
+ } else {
+ s = accept((SOCKET) * this, nullptr, nullptr);
+ }
+
if (s == INVALID_SOCKET)
return -errno;
diff --git a/util/network/socket.h b/util/network/socket.h
index 40c8648b40..21d2525e8f 100644
--- a/util/network/socket.h
+++ b/util/network/socket.h
@@ -236,7 +236,7 @@ private:
class TSocket;
-class TSocketHolder: public TMoveOnly {
+class TSocketHolder: public TMoveOnly {
public:
inline TSocketHolder()
: Fd_(INVALID_SOCKET)
@@ -249,10 +249,10 @@ public:
}
inline TSocketHolder(TSocketHolder&& other) noexcept {
- Fd_ = other.Fd_;
- other.Fd_ = INVALID_SOCKET;
- }
-
+ Fd_ = other.Fd_;
+ other.Fd_ = INVALID_SOCKET;
+ }
+
inline TSocketHolder& operator=(TSocketHolder&& other) noexcept {
Close();
Swap(other);
diff --git a/util/random/entropy.cpp b/util/random/entropy.cpp
index 3617edb83d..5b7da84f56 100644
--- a/util/random/entropy.cpp
+++ b/util/random/entropy.cpp
@@ -177,25 +177,25 @@ namespace {
};
struct TDefaultTraits {
- THolder<TEntropyPoolStream> EP;
+ THolder<TEntropyPoolStream> EP;
TSeedStream SS;
inline TDefaultTraits() {
- Reset();
+ Reset();
}
inline IInputStream& EntropyPool() noexcept {
- return *EP;
+ return *EP;
}
inline IInputStream& Seed() noexcept {
return SS;
}
- inline void Reset() noexcept {
- EP.Reset(new TEntropyPoolStream(THostEntropy()));
- }
-
+ inline void Reset() noexcept {
+ EP.Reset(new TEntropyPoolStream(THostEntropy()));
+ }
+
static inline TDefaultTraits& Instance() {
auto res = SingletonWithPriority<TDefaultTraits, 0>();
@@ -216,6 +216,6 @@ IInputStream& Seed() {
return TRandomTraits::Instance().Seed();
}
-void ResetEntropyPool() {
- TRandomTraits::Instance().Reset();
+void ResetEntropyPool() {
+ TRandomTraits::Instance().Reset();
}
diff --git a/util/random/entropy.h b/util/random/entropy.h
index 62029c1b63..553d0a6fb2 100644
--- a/util/random/entropy.h
+++ b/util/random/entropy.h
@@ -16,6 +16,6 @@ IInputStream& EntropyPool();
IInputStream& Seed();
/*
- * Re-initialize entropy pool - useful after forking in multi-process programs.
+ * Re-initialize entropy pool - useful after forking in multi-process programs.
*/
-void ResetEntropyPool();
+void ResetEntropyPool();
diff --git a/util/random/random.cpp b/util/random/random.cpp
index 71f9323856..8c9f6bec77 100644
--- a/util/random/random.cpp
+++ b/util/random/random.cpp
@@ -86,8 +86,8 @@ DEF_RND(unsigned long)
DEF_RND(unsigned short)
DEF_RND(unsigned long long)
-#undef DEF_RND
-
+#undef DEF_RND
+
template <>
bool RandomNumber<bool>() {
return RandomNumber<ui8>() % 2 == 0;
@@ -113,11 +113,11 @@ template <>
long double RandomNumber<long double>() {
return RandomNumber<double>();
}
-
-void ResetRandomState() {
- *GetRndGen<ui32>() = TRndGen<ui32>();
- *GetRndGen<ui64>() = TRndGen<ui64>();
-}
+
+void ResetRandomState() {
+ *GetRndGen<ui32>() = TRndGen<ui32>();
+ *GetRndGen<ui64>() = TRndGen<ui64>();
+}
void SetRandomSeed(int seed) {
*GetRndGen<ui32>() = TRndGen<ui32>(seed);
diff --git a/util/random/random.h b/util/random/random.h
index 16b52d3995..623639d92c 100644
--- a/util/random/random.h
+++ b/util/random/random.h
@@ -18,11 +18,11 @@ T RandomNumber();
*/
template <class T>
T RandomNumber(T max);
-
-/*
- * Re-initialize random state - useful after forking in multi-process programs.
- */
-void ResetRandomState();
+
+/*
+ * Re-initialize random state - useful after forking in multi-process programs.
+ */
+void ResetRandomState();
/*
* Set random SEED