aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorsvshevtsov <svshevtsov@yandex-team.ru>2022-02-10 16:49:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:37 +0300
commitde89752358147d7b25ef59a85b431bb564068a49 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util
parent657337012a264721d58c470b4e9e796611f3c492 (diff)
downloadydb-de89752358147d7b25ef59a85b431bb564068a49.tar.gz
Restoring authorship annotation for <svshevtsov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/datetime/base.h18
-rw-r--r--util/datetime/base_ut.cpp44
-rw-r--r--util/generic/map_ut.cpp70
-rw-r--r--util/network/sock.h2
-rw-r--r--util/system/file_lock.cpp26
-rw-r--r--util/system/file_lock.h2
-rw-r--r--util/system/flock_ut.cpp6
-rw-r--r--util/system/guard.h12
-rw-r--r--util/system/rusage.cpp4
-rw-r--r--util/system/rusage.h2
10 files changed, 93 insertions, 93 deletions
diff --git a/util/datetime/base.h b/util/datetime/base.h
index 4239ce2e6b..5e902b8f63 100644
--- a/util/datetime/base.h
+++ b/util/datetime/base.h
@@ -148,9 +148,9 @@ public:
}
constexpr TValue Days() const noexcept {
- return Hours() / 24;
- }
-
+ return Hours() / 24;
+ }
+
constexpr TValue NanoSeconds() const noexcept {
return MicroSeconds() >= (Max<TValue>() / (TValue)1000) ? Max<TValue>() : MicroSeconds() * (TValue)1000;
}
@@ -270,7 +270,7 @@ public:
return MicroSeconds((ui64)(typename NDateTimeHelpers::TPrecisionHelper<T>::THighPrecision(ms) * 1000));
}
- using TBase::Days;
+ using TBase::Days;
using TBase::Hours;
using TBase::MicroSeconds;
using TBase::MilliSeconds;
@@ -376,7 +376,7 @@ public:
return TInstant::MicroSeconds(::MicroSeconds());
}
- using TBase::Days;
+ using TBase::Days;
using TBase::Hours;
using TBase::MicroSeconds;
using TBase::MilliSeconds;
@@ -416,11 +416,11 @@ public:
return Minutes(h * 60);
}
- /// days since epoch
+ /// days since epoch
static constexpr TInstant Days(ui64 d) noexcept {
- return Hours(d * 24);
- }
-
+ return Hours(d * 24);
+ }
+
constexpr time_t TimeT() const noexcept {
return (time_t)Seconds();
}
diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp
index 7eb7adccef..afc3f802eb 100644
--- a/util/datetime/base_ut.cpp
+++ b/util/datetime/base_ut.cpp
@@ -459,38 +459,38 @@ Y_UNIT_TEST_SUITE(DateTimeTest) {
UNIT_ASSERT_VALUES_EQUAL(value.MicroSeconds(), 1234567);
}
- template <class T>
- void TestTimeUnits() {
+ template <class T>
+ void TestTimeUnits() {
T withTime = T::MicroSeconds(1249571946000000L);
T onlyMinutes = T::MicroSeconds(1249571940000000L);
T onlyHours = T::MicroSeconds(1249570800000000L);
T onlyDays = T::MicroSeconds(1249516800000000L);
- ui64 minutes = 20826199;
+ ui64 minutes = 20826199;
ui64 hours = 347103;
- ui64 days = 14462;
-
- UNIT_ASSERT_VALUES_EQUAL(withTime.Minutes(), minutes);
- UNIT_ASSERT_VALUES_EQUAL(onlyMinutes, T::Minutes(minutes));
- UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Minutes(), minutes);
-
+ ui64 days = 14462;
+
+ UNIT_ASSERT_VALUES_EQUAL(withTime.Minutes(), minutes);
+ UNIT_ASSERT_VALUES_EQUAL(onlyMinutes, T::Minutes(minutes));
+ UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Minutes(), minutes);
+
UNIT_ASSERT_VALUES_EQUAL(withTime.Hours(), hours);
- UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Hours(), hours);
- UNIT_ASSERT_VALUES_EQUAL(onlyHours, T::Hours(hours));
+ UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Hours(), hours);
+ UNIT_ASSERT_VALUES_EQUAL(onlyHours, T::Hours(hours));
UNIT_ASSERT_VALUES_EQUAL(onlyHours.Hours(), hours);
-
- UNIT_ASSERT_VALUES_EQUAL(withTime.Days(), days);
- UNIT_ASSERT_VALUES_EQUAL(onlyHours.Days(), days);
- UNIT_ASSERT_VALUES_EQUAL(onlyDays, T::Days(days));
- UNIT_ASSERT_VALUES_EQUAL(onlyDays.Days(), days);
+
+ UNIT_ASSERT_VALUES_EQUAL(withTime.Days(), days);
+ UNIT_ASSERT_VALUES_EQUAL(onlyHours.Days(), days);
+ UNIT_ASSERT_VALUES_EQUAL(onlyDays, T::Days(days));
+ UNIT_ASSERT_VALUES_EQUAL(onlyDays.Days(), days);
}
-
+
Y_UNIT_TEST(TestInstantUnits) {
- TestTimeUnits<TInstant>();
- }
-
+ TestTimeUnits<TInstant>();
+ }
+
Y_UNIT_TEST(TestDurationUnits) {
- TestTimeUnits<TDuration>();
- }
+ TestTimeUnits<TDuration>();
+ }
Y_UNIT_TEST(TestNoexceptConstruction) {
UNIT_ASSERT_EXCEPTION(TDuration::MilliSeconds(FromString(TStringBuf("not a number"))), yexception);
diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp
index c705c7d636..79e832b024 100644
--- a/util/generic/map_ut.cpp
+++ b/util/generic/map_ut.cpp
@@ -402,49 +402,49 @@ Y_UNIT_TEST_SUITE(TYMapTest) {
EmptyAndInsertTest<TMap<char, int, TLess<char>>>(std::pair<char, int>('a', 1));
EmptyAndInsertTest<TMultiMap<char, int, TLess<char>>>(std::pair<char, int>('a', 1));
}
-
- struct TParametrizedKeyCmp {
- bool Inverse;
-
- TParametrizedKeyCmp(bool inverse = false)
- : Inverse(inverse)
- {
- }
-
- bool operator()(TKey lhs, TKey rhs) const {
- if (Inverse) {
- return lhs.m_data > rhs.m_data;
- } else {
- return lhs.m_data < rhs.m_data;
- }
- }
- };
-
+
+ struct TParametrizedKeyCmp {
+ bool Inverse;
+
+ TParametrizedKeyCmp(bool inverse = false)
+ : Inverse(inverse)
+ {
+ }
+
+ bool operator()(TKey lhs, TKey rhs) const {
+ if (Inverse) {
+ return lhs.m_data > rhs.m_data;
+ } else {
+ return lhs.m_data < rhs.m_data;
+ }
+ }
+ };
+
Y_UNIT_TEST(TestMoveComparator) {
using Container = TMultiMap<TKey, int, TParametrizedKeyCmp>;
-
- TParametrizedKeyCmp direct(false);
- TParametrizedKeyCmp inverse(true);
-
- {
- Container c(direct);
- c = Container(inverse);
-
+
+ TParametrizedKeyCmp direct(false);
+ TParametrizedKeyCmp inverse(true);
+
+ {
+ Container c(direct);
+ c = Container(inverse);
+
c.insert(std::make_pair(TKey(1), 101));
c.insert(std::make_pair(TKey(2), 102));
c.insert(std::make_pair(TKey(3), 103));
-
+
TVector<int> values;
for (auto& i : c) {
values.push_back(i.second);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(values.size(), 3);
- UNIT_ASSERT_VALUES_EQUAL(values[0], 103);
- UNIT_ASSERT_VALUES_EQUAL(values[1], 102);
- UNIT_ASSERT_VALUES_EQUAL(values[2], 101);
- }
- }
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(values.size(), 3);
+ UNIT_ASSERT_VALUES_EQUAL(values[0], 103);
+ UNIT_ASSERT_VALUES_EQUAL(values[1], 102);
+ UNIT_ASSERT_VALUES_EQUAL(values[2], 101);
+ }
+ }
Y_UNIT_TEST(TestMapInitializerList) {
TMap<TString, int> m = {
diff --git a/util/network/sock.h b/util/network/sock.h
index ec8d146287..b10be2f715 100644
--- a/util/network/sock.h
+++ b/util/network/sock.h
@@ -326,7 +326,7 @@ struct TSockAddrInet6: public sockaddr_in6, public ISockAddr {
TString GetIp() const noexcept {
char ip6[INET6_ADDRSTRLEN];
- inet_ntop(AF_INET6, (void*)&sin6_addr, ip6, INET6_ADDRSTRLEN);
+ inet_ntop(AF_INET6, (void*)&sin6_addr, ip6, INET6_ADDRSTRLEN);
return TString(ip6);
}
diff --git a/util/system/file_lock.cpp b/util/system/file_lock.cpp
index 81558eb09f..45d91282c5 100644
--- a/util/system/file_lock.cpp
+++ b/util/system/file_lock.cpp
@@ -1,10 +1,10 @@
#include "file_lock.h"
#include "flock.h"
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
#include <cerrno>
-
+
namespace {
int GetMode(const EFileLockType type) {
switch (type) {
@@ -29,18 +29,18 @@ void TFileLock::Acquire() {
Flock(GetMode(Type));
}
-bool TFileLock::TryAcquire() {
- try {
+bool TFileLock::TryAcquire() {
+ try {
Flock(GetMode(Type) | LOCK_NB);
- return true;
- } catch (const TSystemError& e) {
- if (e.Status() != EWOULDBLOCK) {
- throw;
- }
- return false;
- }
-}
-
+ return true;
+ } catch (const TSystemError& e) {
+ if (e.Status() != EWOULDBLOCK) {
+ throw;
+ }
+ return false;
+ }
+}
+
void TFileLock::Release() {
Flock(LOCK_UN);
}
diff --git a/util/system/file_lock.h b/util/system/file_lock.h
index 5921d9a707..b2aaff5baf 100644
--- a/util/system/file_lock.h
+++ b/util/system/file_lock.h
@@ -14,7 +14,7 @@ public:
TFileLock(const TString& filename, const EFileLockType type = EFileLockType::Exclusive);
void Acquire();
- bool TryAcquire();
+ bool TryAcquire();
void Release();
inline void lock() {
diff --git a/util/system/flock_ut.cpp b/util/system/flock_ut.cpp
index 26afbbc047..b5f6cb5328 100644
--- a/util/system/flock_ut.cpp
+++ b/util/system/flock_ut.cpp
@@ -23,10 +23,10 @@ Y_UNIT_TEST_SUITE(TFileLockTest) {
{
TGuard<TFileLock> guard(fileLockExclusive1);
}
- {
+ {
TTryGuard<TFileLock> tryGuard(fileLockExclusive1);
- UNIT_ASSERT(tryGuard.WasAcquired());
- }
+ UNIT_ASSERT(tryGuard.WasAcquired());
+ }
{
TGuard<TFileLock> guard1(fileLockExclusive1);
TTryGuard<TFileLock> guard2(fileLockExclusive2);
diff --git a/util/system/guard.h b/util/system/guard.h
index b92d6432dd..efc091d5f8 100644
--- a/util/system/guard.h
+++ b/util/system/guard.h
@@ -137,12 +137,12 @@ public:
Init(t);
}
- inline TTryGuard(TTryGuard&& g) noexcept
- : T_(g.T_)
- {
- g.T_ = nullptr;
- }
-
+ inline TTryGuard(TTryGuard&& g) noexcept
+ : T_(g.T_)
+ {
+ g.T_ = nullptr;
+ }
+
inline ~TTryGuard() {
Release();
}
diff --git a/util/system/rusage.cpp b/util/system/rusage.cpp
index 4d15a48a7d..2befeca875 100644
--- a/util/system/rusage.cpp
+++ b/util/system/rusage.cpp
@@ -99,7 +99,7 @@ void TRusage::Fill() {
}
MaxRss = pmc.PeakWorkingSetSize;
- MajorPageFaults = pmc.PageFaultCount;
+ MajorPageFaults = pmc.PageFaultCount;
#else
struct rusage ru;
@@ -114,7 +114,7 @@ void TRusage::Fill() {
#else
MaxRss = ru.ru_maxrss * 1024LL;
#endif
- MajorPageFaults = ru.ru_majflt;
+ MajorPageFaults = ru.ru_majflt;
Utime = ru.ru_utime;
Stime = ru.ru_stime;
#endif
diff --git a/util/system/rusage.h b/util/system/rusage.h
index bb3725a7f7..61aeca83f2 100644
--- a/util/system/rusage.h
+++ b/util/system/rusage.h
@@ -10,7 +10,7 @@ struct TRusage {
// some fields may be zero if unsupported
ui64 MaxRss = 0;
- ui64 MajorPageFaults = 0;
+ ui64 MajorPageFaults = 0;
TDuration Utime;
TDuration Stime;