aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authordmikhalev <dmikhalev@yandex-team.ru>2022-02-10 16:49:29 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:29 +0300
commitb93b3eb857a34bc32cef3c1b0c709e8365253b34 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util
parent3b5ee31ed70f690af39dfdec632060610b71b89e (diff)
downloadydb-b93b3eb857a34bc32cef3c1b0c709e8365253b34.tar.gz
Restoring authorship annotation for <dmikhalev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/digest/numeric.h2
-rw-r--r--util/draft/holder_vector.h2
-rw-r--r--util/folder/dirut.cpp12
-rw-r--r--util/folder/iterator_ut.cpp6
-rw-r--r--util/generic/bitmap.h52
-rw-r--r--util/generic/bitmap_ut.cpp28
-rw-r--r--util/network/socket.cpp6
-rw-r--r--util/system/context.cpp2
-rw-r--r--util/system/daemon.cpp20
-rw-r--r--util/system/daemon.h2
-rw-r--r--util/system/fs.cpp8
11 files changed, 70 insertions, 70 deletions
diff --git a/util/digest/numeric.h b/util/digest/numeric.h
index 53abcd145c..e20bd908e4 100644
--- a/util/digest/numeric.h
+++ b/util/digest/numeric.h
@@ -77,7 +77,7 @@ static constexpr size_t NumericHash(T t) noexcept {
TCvt cvt;
} u{t};
- return (size_t)IntHash(u.cvt);
+ return (size_t)IntHash(u.cvt);
}
template <class T>
diff --git a/util/draft/holder_vector.h b/util/draft/holder_vector.h
index 8c9ac0ba23..1c62055bd9 100644
--- a/util/draft/holder_vector.h
+++ b/util/draft/holder_vector.h
@@ -91,7 +91,7 @@ public:
using TBase::empty;
using TBase::end;
using TBase::front;
- using TBase::reserve;
+ using TBase::reserve;
using TBase::size;
using typename TBase::const_iterator;
diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp
index 1541245b5d..ffc9b09f96 100644
--- a/util/folder/dirut.cpp
+++ b/util/folder/dirut.cpp
@@ -491,12 +491,12 @@ void MakePathIfNotExist(const char* path, int mode) {
const char* GetFileNameComponent(const char* f) {
const char* p = strrchr(f, LOCSLASH_C);
-#ifdef _win_
- // "/" is also valid char separator on Windows
- const char* p2 = strrchr(f, '/');
- if (p2 > p)
- p = p2;
-#endif
+#ifdef _win_
+ // "/" is also valid char separator on Windows
+ const char* p2 = strrchr(f, '/');
+ if (p2 > p)
+ p = p2;
+#endif
if (p) {
return p + 1;
diff --git a/util/folder/iterator_ut.cpp b/util/folder/iterator_ut.cpp
index e9797e0698..936becd139 100644
--- a/util/folder/iterator_ut.cpp
+++ b/util/folder/iterator_ut.cpp
@@ -82,9 +82,9 @@ private:
inline ~TDirHier() {
for (size_t i = 0; i < Paths_.size(); ++i) {
NFs::Remove(Paths_[Paths_.size() - i - 1].Path);
- }
- }
-
+ }
+ }
+
private:
TVector<TPath> Paths_;
THashMap<TString, TPath> Srch_;
diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h
index 565d86c2d1..f77d182460 100644
--- a/util/generic/bitmap.h
+++ b/util/generic/bitmap.h
@@ -566,28 +566,28 @@ public:
}
template <class TTo>
- void Export(size_t pos, TTo& to) const {
+ void Export(size_t pos, TTo& to) const {
static_assert(std::is_unsigned<TTo>::value, "expect std::is_unsigned<TTo>::value");
- to = 0;
- size_t chunkpos = pos >> DivCount;
- if (chunkpos >= Mask.GetChunkCapacity())
- return;
- if ((pos & ModMask) == 0) {
- if (sizeof(TChunk) >= sizeof(TTo))
- to = (TTo)Mask.Data[chunkpos];
- else //if (sizeof(TChunk) < sizeof(TTo))
- NBitMapPrivate::CopyData(&to, 1, Mask.Data + chunkpos, Min(((sizeof(TTo) * 8) >> DivCount), Mask.GetChunkCapacity() - chunkpos));
- } else if ((pos & (sizeof(TTo) * 8 - 1)) == 0 && sizeof(TChunk) >= 2 * sizeof(TTo))
- to = (TTo)(Mask.Data[chunkpos] >> (pos & ModMask));
- else {
+ to = 0;
+ size_t chunkpos = pos >> DivCount;
+ if (chunkpos >= Mask.GetChunkCapacity())
+ return;
+ if ((pos & ModMask) == 0) {
+ if (sizeof(TChunk) >= sizeof(TTo))
+ to = (TTo)Mask.Data[chunkpos];
+ else //if (sizeof(TChunk) < sizeof(TTo))
+ NBitMapPrivate::CopyData(&to, 1, Mask.Data + chunkpos, Min(((sizeof(TTo) * 8) >> DivCount), Mask.GetChunkCapacity() - chunkpos));
+ } else if ((pos & (sizeof(TTo) * 8 - 1)) == 0 && sizeof(TChunk) >= 2 * sizeof(TTo))
+ to = (TTo)(Mask.Data[chunkpos] >> (pos & ModMask));
+ else {
static constexpr size_t copyToSize = (sizeof(TChunk) >= sizeof(TTo)) ? (sizeof(TChunk) / sizeof(TTo)) + 2 : 3;
- TTo temp[copyToSize] = {0, 0};
- //or use non defined by now TBitmap<copyToSize, TTo>::CopyData,RShift(pos & ModMask),Export(0,to)
- NBitMapPrivate::CopyData(temp, copyToSize, Mask.Data + chunkpos, Min((sizeof(TTo) / sizeof(TChunk)) + 1, Mask.GetChunkCapacity() - chunkpos));
- to = (temp[0] >> (pos & ModMask)) | (temp[1] << (8 * sizeof(TTo) - (pos & ModMask)));
- }
- }
-
+ TTo temp[copyToSize] = {0, 0};
+ //or use non defined by now TBitmap<copyToSize, TTo>::CopyData,RShift(pos & ModMask),Export(0,to)
+ NBitMapPrivate::CopyData(temp, copyToSize, Mask.Data + chunkpos, Min((sizeof(TTo) / sizeof(TChunk)) + 1, Mask.GetChunkCapacity() - chunkpos));
+ to = (temp[0] >> (pos & ModMask)) | (temp[1] << (8 * sizeof(TTo) - (pos & ModMask)));
+ }
+ }
+
Y_FORCE_INLINE bool Test(size_t n) const {
return Get(n);
}
@@ -608,8 +608,8 @@ public:
Mask.Data[i] = 0;
}
return *this;
- }
-
+ }
+
// Returns bits capacity
Y_FORCE_INLINE constexpr size_t Size() const noexcept {
return Mask.GetBitCapacity();
@@ -631,10 +631,10 @@ public:
Y_PURE_FUNCTION Y_FORCE_INLINE bool Empty() const {
for (size_t i = 0; i < Mask.GetChunkCapacity(); ++i)
if (Mask.Data[i])
- return false;
- return true;
- }
-
+ return false;
+ return true;
+ }
+
bool HasAny(const TThis& bitmap) const {
for (size_t i = 0; i < Min(Mask.GetChunkCapacity(), bitmap.Mask.GetChunkCapacity()); ++i) {
if (0 != (Mask.Data[i] & bitmap.Mask.Data[i])) {
diff --git a/util/generic/bitmap_ut.cpp b/util/generic/bitmap_ut.cpp
index de3fedbc0a..087d34a8dc 100644
--- a/util/generic/bitmap_ut.cpp
+++ b/util/generic/bitmap_ut.cpp
@@ -264,25 +264,25 @@ Y_UNIT_TEST_SUITE(TBitMapTest) {
TDynBitMap bitmap4 = ~((bitmap3 | 3) & bitmap2);
CHECK_BITMAP_WITH_TAIL(bitmap4, resBits);
-
- TBitMap<128, ui32> expmap;
- expmap.Set(47);
- expmap.Set(90);
- ui64 tst1 = 0;
- ui32 tst2 = 0;
- ui16 tst3 = 0;
- expmap.Export(32, tst1);
+
+ TBitMap<128, ui32> expmap;
+ expmap.Set(47);
+ expmap.Set(90);
+ ui64 tst1 = 0;
+ ui32 tst2 = 0;
+ ui16 tst3 = 0;
+ expmap.Export(32, tst1);
UNIT_ASSERT_EQUAL(tst1, (1 << 15) | (((ui64)1) << 58));
- expmap.Export(32, tst2);
+ expmap.Export(32, tst2);
UNIT_ASSERT_EQUAL(tst2, (1 << 15));
- expmap.Export(32, tst3);
+ expmap.Export(32, tst3);
UNIT_ASSERT_EQUAL(tst3, (1 << 15));
-
- expmap.Export(33, tst1);
+
+ expmap.Export(33, tst1);
UNIT_ASSERT_EQUAL(tst1, (1 << 14) | (((ui64)1) << 57));
- expmap.Export(33, tst2);
+ expmap.Export(33, tst2);
UNIT_ASSERT_EQUAL(tst2, (1 << 14));
- expmap.Export(33, tst3);
+ expmap.Export(33, tst3);
UNIT_ASSERT_EQUAL(tst3, (1 << 14));
}
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index e568eacbbc..4f6e804346 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -707,10 +707,10 @@ static inline SOCKET DoConnect(const struct addrinfo* res, const TInstant& deadL
}
static inline ssize_t DoSendV(SOCKET fd, const struct iovec* iov, size_t count) {
- ssize_t ret = -1;
- do {
+ ssize_t ret = -1;
+ do {
ret = DoSendMsg(fd, iov, (int)count);
- } while (ret == -1 && errno == EINTR);
+ } while (ret == -1 && errno == EINTR);
if (ret < 0) {
return -LastSystemError();
diff --git a/util/system/context.cpp b/util/system/context.cpp
index cbf823afee..ad99309088 100644
--- a/util/system/context.cpp
+++ b/util/system/context.cpp
@@ -227,7 +227,7 @@ TContMachineContext::TContMachineContext()
TContMachineContext::TContMachineContext(const TContClosure& c)
: Fiber_(CreateFiber(c.Stack.size(), (LPFIBER_START_ROUTINE)ContextTrampoLine, (LPVOID)c.TrampoLine))
, MainFiber_(false)
-{
+{
Y_ENSURE(Fiber_, TStringBuf("fiber error"));
}
diff --git a/util/system/daemon.cpp b/util/system/daemon.cpp
index ced376487a..130e6c8f45 100644
--- a/util/system/daemon.cpp
+++ b/util/system/daemon.cpp
@@ -1,17 +1,17 @@
#include <util/generic/yexception.h>
-#include <cerrno>
+#include <cerrno>
#include <cstdlib>
#include <util/system/info.h>
-#if defined(_win_)
+#if defined(_win_)
#include <io.h>
-#else
+#else
#include <sys/wait.h>
#include <unistd.h>
#include <fcntl.h>
-#endif
-
+#endif
+
#include "daemon.h"
#ifdef _unix_
@@ -62,18 +62,18 @@ static void CloseFromToExcept(int from, int to, const int* except) {
goto dontclose;
}
}
- while (close(s) == -1) {
+ while (close(s) == -1) {
if (errno == EBADF) {
- break;
+ break;
}
if (errno != EINTR) {
ythrow TSystemError() << "close(" << s << ") failed";
}
- }
+ }
dontclose:;
}
-#endif /* _unix_ */
-}
+#endif /* _unix_ */
+}
bool NDaemonMaker::MakeMeDaemon(ECloseDescriptors cd, EStdIoDescriptors iod, EChDir chd, EParent parent) {
(void)cd;
diff --git a/util/system/daemon.h b/util/system/daemon.h
index 31689f9cda..b00793b9c9 100644
--- a/util/system/daemon.h
+++ b/util/system/daemon.h
@@ -23,5 +23,5 @@ namespace NDaemonMaker {
};
bool MakeMeDaemon(ECloseDescriptors cd = closeAll, EStdIoDescriptors iod = openDevNull, EChDir chd = chdirRoot, EParent parent = callExitFromParent);
- void CloseFrom(int fd);
+ void CloseFrom(int fd);
}
diff --git a/util/system/fs.cpp b/util/system/fs.cpp
index c8988d85d6..d2611a8ccc 100644
--- a/util/system/fs.cpp
+++ b/util/system/fs.cpp
@@ -91,7 +91,7 @@ bool NFs::Rename(const TString& oldPath, const TString& newPath) {
return ::rename(oldPath.data(), newPath.data()) == 0;
#endif
}
-
+
void NFs::HardLinkOrCopy(const TString& existingPath, const TString& newPath) {
if (!NFs::HardLink(existingPath, newPath)) {
Copy(existingPath, newPath);
@@ -101,10 +101,10 @@ void NFs::HardLinkOrCopy(const TString& existingPath, const TString& newPath) {
bool NFs::HardLink(const TString& existingPath, const TString& newPath) {
#if defined(_win_)
return NFsPrivate::WinHardLink(existingPath, newPath);
-#elif defined(_unix_)
+#elif defined(_unix_)
return (0 == link(existingPath.data(), newPath.data()));
-#endif
-}
+#endif
+}
bool NFs::SymLink(const TString& targetPath, const TString& linkPath) {
#if defined(_win_)