aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authoronpopov <onpopov@yandex-team.ru>2022-02-10 16:50:38 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:38 +0300
commit84a29dd4980d5b39615e453f289bd1a81213296d (patch)
tree5e320f10d6b5863e0d5ab1a8caa9eefbdaa5195f /util
parent1717072c6635948128dad7b015a0ec05acbe913b (diff)
downloadydb-84a29dd4980d5b39615e453f289bd1a81213296d.tar.gz
Restoring authorship annotation for <onpopov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/datetime/cputimer.cpp10
-rw-r--r--util/datetime/cputimer.h4
-rw-r--r--util/generic/strbase.h4
-rw-r--r--util/string/cast.h10
-rw-r--r--util/string/util.cpp18
-rw-r--r--util/string/util.h28
-rw-r--r--util/system/getpid.cpp20
-rw-r--r--util/system/getpid.h6
-rw-r--r--util/system/getpid_ut.cpp34
-rw-r--r--util/thread/pool.cpp4
-rw-r--r--util/thread/pool.h4
11 files changed, 71 insertions, 71 deletions
diff --git a/util/datetime/cputimer.cpp b/util/datetime/cputimer.cpp
index 516d372c37..846f63ee18 100644
--- a/util/datetime/cputimer.cpp
+++ b/util/datetime/cputimer.cpp
@@ -19,15 +19,15 @@
TTimer::TTimer(const TStringBuf message) {
static const int SMALL_DURATION_CHAR_LENGTH = 9; // strlen("0.123456s")
Message_.Reserve(message.length() + SMALL_DURATION_CHAR_LENGTH + 1); // +"\n"
- Message_ << message;
- // Do not measure the allocations above.
+ Message_ << message;
+ // Do not measure the allocations above.
Start_ = TInstant::Now();
}
TTimer::~TTimer() {
- const TDuration duration = TInstant::Now() - Start_;
- Message_ << duration << "\n";
- Cerr << Message_.Str();
+ const TDuration duration = TInstant::Now() - Start_;
+ Message_ << duration << "\n";
+ Cerr << Message_.Str();
}
static ui64 ManuallySetCyclesPerSecond = 0;
diff --git a/util/datetime/cputimer.h b/util/datetime/cputimer.h
index 7d38d5bdb3..1d39d74190 100644
--- a/util/datetime/cputimer.h
+++ b/util/datetime/cputimer.h
@@ -4,12 +4,12 @@
#include <util/system/rusage.h>
#include <util/generic/string.h>
-#include <util/stream/str.h>
+#include <util/stream/str.h>
class TTimer {
private:
TInstant Start_;
- TStringStream Message_;
+ TStringStream Message_;
public:
TTimer(const TStringBuf message = TStringBuf(" took: "));
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index ab39fc7537..67e9773f24 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -530,8 +530,8 @@ public:
inline size_t find_last_of(const TStringView set, size_t pos = npos) const noexcept {
return find_last_of(set.data(), pos, set.length());
- }
-
+ }
+
inline size_t find_last_of(const TCharType* set, size_t pos, size_t n) const noexcept {
return AsStringView().find_last_of(set, pos, n);
}
diff --git a/util/string/cast.h b/util/string/cast.h
index 90e925c194..6fcdb5676f 100644
--- a/util/string/cast.h
+++ b/util/string/cast.h
@@ -104,13 +104,13 @@ inline TString ToString(char* s) {
}
/*
- * Wrapper for wide strings.
- */
+ * Wrapper for wide strings.
+ */
template <class T>
inline TUtf16String ToWtring(const T& t) {
return TUtf16String::FromAscii(ToString(t));
-}
-
+}
+
inline const TUtf16String& ToWtring(const TUtf16String& w) {
return w;
}
@@ -122,7 +122,7 @@ inline const TUtf16String& ToWtring(TUtf16String& w) {
struct TFromStringException: public TBadCastException {
};
-/*
+/*
* specialized for:
* bool
* short
diff --git a/util/string/util.cpp b/util/string/util.cpp
index b14f20bf75..faf105b280 100644
--- a/util/string/util.cpp
+++ b/util/string/util.cpp
@@ -51,22 +51,22 @@ Tr::Tr(const char* from, const char* to) {
size_t Tr::FindFirstChangePosition(const TString& str) const {
for (auto it = str.begin(); it != str.end(); ++it) {
- if (ConvertChar(*it) != *it) {
- return it - str.begin();
- }
- }
+ if (ConvertChar(*it) != *it) {
+ return it - str.begin();
+ }
+ }
return TString::npos;
-}
-
+}
+
void Tr::Do(TString& str) const {
- const size_t changePosition = FindFirstChangePosition(str);
+ const size_t changePosition = FindFirstChangePosition(str);
if (changePosition == TString::npos) {
- return;
+ return;
}
for (auto it = str.begin() + changePosition; it != str.end(); ++it) {
- *it = ConvertChar(*it);
+ *it = ConvertChar(*it);
}
}
diff --git a/util/string/util.h b/util/string/util.h
index 0d77a5042b..2ecafeaae3 100644
--- a/util/string/util.h
+++ b/util/string/util.h
@@ -152,32 +152,32 @@ protected:
};
// an analogue of tr/$from/$to/
-class Tr {
-public:
+class Tr {
+public:
Tr(const char* from, const char* to);
-
- char ConvertChar(char ch) const {
- return Map[(ui8)ch];
- }
-
+
+ char ConvertChar(char ch) const {
+ return Map[(ui8)ch];
+ }
+
void Do(char* s) const {
for (; *s; s++)
- *s = ConvertChar(*s);
+ *s = ConvertChar(*s);
}
void Do(const char* src, char* dst) const {
for (; *src; src++)
- *dst++ = ConvertChar(*src);
+ *dst++ = ConvertChar(*src);
*dst = 0;
}
void Do(char* s, size_t l) const {
for (size_t i = 0; i < l && s[i]; i++)
- s[i] = ConvertChar(s[i]);
+ s[i] = ConvertChar(s[i]);
}
void Do(TString& str) const;
-
-private:
- char Map[256];
-
+
+private:
+ char Map[256];
+
size_t FindFirstChangePosition(const TString& str) const;
};
diff --git a/util/system/getpid.cpp b/util/system/getpid.cpp
index b9615f0dfa..fc4f2e7427 100644
--- a/util/system/getpid.cpp
+++ b/util/system/getpid.cpp
@@ -1,6 +1,6 @@
-#include "getpid.h"
-
-#ifdef _win_
+#include "getpid.h"
+
+#ifdef _win_
// The include file should be Windows.h for Windows <=7, Processthreadsapi.h for Windows >=8 and Server 2012,
// see http://msdn.microsoft.com/en-us/library/windows/desktop/ms683180%28v=vs.85%29.aspx
// The way to determine windows version is described in http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx
@@ -13,11 +13,11 @@
#include <sys/types.h>
#include <unistd.h>
#endif
-
+
TProcessId GetPID() {
-#ifdef _win_
- return GetCurrentProcessId();
-#else
- return getpid();
-#endif
-}
+#ifdef _win_
+ return GetCurrentProcessId();
+#else
+ return getpid();
+#endif
+}
diff --git a/util/system/getpid.h b/util/system/getpid.h
index 60e243266f..906d21f3ed 100644
--- a/util/system/getpid.h
+++ b/util/system/getpid.h
@@ -1,8 +1,8 @@
-#pragma once
-
+#pragma once
+
#include "platform.h"
#include "types.h"
-
+
#if defined(_win_)
using TProcessId = ui32; // DWORD
#else
diff --git a/util/system/getpid_ut.cpp b/util/system/getpid_ut.cpp
index e7122a2971..149e7f2082 100644
--- a/util/system/getpid_ut.cpp
+++ b/util/system/getpid_ut.cpp
@@ -1,19 +1,19 @@
-#include "getpid.h"
-
+#include "getpid.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
-class TGetPidTest: public TTestBase {
- UNIT_TEST_SUITE(TGetPidTest);
- UNIT_TEST(Test);
- UNIT_TEST_SUITE_END();
-
-public:
- void Test();
-};
-
-UNIT_TEST_SUITE_REGISTRATION(TGetPidTest);
-
-void TGetPidTest::Test() {
+
+class TGetPidTest: public TTestBase {
+ UNIT_TEST_SUITE(TGetPidTest);
+ UNIT_TEST(Test);
+ UNIT_TEST_SUITE_END();
+
+public:
+ void Test();
+};
+
+UNIT_TEST_SUITE_REGISTRATION(TGetPidTest);
+
+void TGetPidTest::Test() {
const TProcessId pid = GetPID();
- UNIT_ASSERT(pid != 0);
-}
+ UNIT_ASSERT(pid != 0);
+}
diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp
index 05fad02e9b..10b74efb80 100644
--- a/util/thread/pool.cpp
+++ b/util/thread/pool.cpp
@@ -592,7 +592,7 @@ size_t TAdaptiveThreadPool::Size() const noexcept {
void TAdaptiveThreadPool::SetMaxIdleTime(TDuration interval) {
Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));
- Impl_->SetMaxIdleTime(interval);
+ Impl_->SetMaxIdleTime(interval);
}
TSimpleThreadPool::~TSimpleThreadPool() {
@@ -623,7 +623,7 @@ void TSimpleThreadPool::Start(size_t thrnum, size_t maxque) {
tmp->Start(thrnum, maxque);
if (adaptive) {
- adaptive->SetMaxIdleTime(TDuration::Seconds(100));
+ adaptive->SetMaxIdleTime(TDuration::Seconds(100));
}
Slave_.Swap(tmp);
diff --git a/util/thread/pool.h b/util/thread/pool.h
index d1ea3a67cb..9f92eec8da 100644
--- a/util/thread/pool.h
+++ b/util/thread/pool.h
@@ -10,8 +10,8 @@
#include <util/generic/noncopyable.h>
#include <functional>
-class TDuration;
-
+class TDuration;
+
struct IObjectInQueue {
virtual ~IObjectInQueue() = default;