aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authorleo <leo@yandex-team.ru>2022-02-10 16:46:40 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:40 +0300
commit99609724f661f7e21d1cb08e8d80e87c3632fdb3 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /util/generic
parent980edcd3304699edf9d4e4d6a656e585028e2a72 (diff)
downloadydb-99609724f661f7e21d1cb08e8d80e87c3632fdb3.tar.gz
Restoring authorship annotation for <leo@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/buffer.cpp2
-rw-r--r--util/generic/buffer.h2
-rw-r--r--util/generic/hash.h8
-rw-r--r--util/generic/intrlist_ut.cpp10
-rw-r--r--util/generic/ptr.h14
-rw-r--r--util/generic/ptr_ut.cpp106
-rw-r--r--util/generic/refcount.h2
-rw-r--r--util/generic/strbase.h2
-rw-r--r--util/generic/string.cpp10
-rw-r--r--util/generic/string.h6
-rw-r--r--util/generic/string_ut.h24
-rw-r--r--util/generic/vector.h4
-rw-r--r--util/generic/yexception_ut.cpp4
-rw-r--r--util/generic/ymath.cpp2
-rw-r--r--util/generic/ymath.h6
15 files changed, 101 insertions, 101 deletions
diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp
index cc39f809f3..b92697e1d0 100644
--- a/util/generic/buffer.cpp
+++ b/util/generic/buffer.cpp
@@ -1,7 +1,7 @@
#include "buffer.h"
#include "mem_copy.h"
#include "string.h"
-#include "ymath.h"
+#include "ymath.h"
#include <util/system/sys_alloc.h>
#include <util/system/sanitizers.h>
diff --git a/util/generic/buffer.h b/util/generic/buffer.h
index e7811a2fc9..9576467404 100644
--- a/util/generic/buffer.h
+++ b/util/generic/buffer.h
@@ -6,7 +6,7 @@
#include <util/system/align.h>
#include <util/system/yassert.h>
-#include <cstring>
+#include <cstring>
class TBuffer {
public:
diff --git a/util/generic/hash.h b/util/generic/hash.h
index 8d5e01bcaf..e46db21fa9 100644
--- a/util/generic/hash.h
+++ b/util/generic/hash.h
@@ -958,12 +958,12 @@ template <class V>
__yhashtable_iterator<V>& __yhashtable_iterator<V>::operator++() {
Y_ASSERT(cur);
cur = cur->next;
- if ((uintptr_t)cur & 1) {
+ if ((uintptr_t)cur & 1) {
node** bucket = (node**)((uintptr_t)cur & ~1);
while (*bucket == nullptr)
++bucket;
Y_ASSERT(*bucket != nullptr);
- cur = (node*)((uintptr_t)*bucket & ~1);
+ cur = (node*)((uintptr_t)*bucket & ~1);
}
return *this;
}
@@ -979,12 +979,12 @@ template <class V>
__yhashtable_const_iterator<V>& __yhashtable_const_iterator<V>::operator++() {
Y_ASSERT(cur);
cur = cur->next;
- if ((uintptr_t)cur & 1) {
+ if ((uintptr_t)cur & 1) {
node** bucket = (node**)((uintptr_t)cur & ~1);
while (*bucket == nullptr)
++bucket;
Y_ASSERT(*bucket != nullptr);
- cur = (node*)((uintptr_t)*bucket & ~1);
+ cur = (node*)((uintptr_t)*bucket & ~1);
}
return *this;
}
diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp
index 2d4a1a44df..eff7cdf2ee 100644
--- a/util/generic/intrlist_ut.cpp
+++ b/util/generic/intrlist_ut.cpp
@@ -236,12 +236,12 @@ static void CheckIterationAfterCut(const TMyList& l, const TMyList& l2, size_t N
UNIT_ASSERT_EQUAL(c, 0);
}
-static void TestCutFront(int N, int M) {
+static void TestCutFront(int N, int M) {
TMyList l(N);
TMyList l2(0);
TMyList::TIterator it = l.Begin();
- for (int i = 0; i < M; ++i) {
+ for (int i = 0; i < M; ++i) {
++it;
}
@@ -249,12 +249,12 @@ static void TestCutFront(int N, int M) {
CheckIterationAfterCut(l2, l, N, M);
}
-static void TestCutBack(int N, int M) {
+static void TestCutBack(int N, int M) {
TMyList l(N);
TMyList l2(0);
TMyList::TIterator it = l.Begin();
- for (int i = 0; i < M; ++i) {
+ for (int i = 0; i < M; ++i) {
++it;
}
@@ -291,7 +291,7 @@ static void CheckIterationAfterAppend(const TMyList& l, size_t N, size_t M) {
UNIT_ASSERT_EQUAL(it, l.End());
}
-static void TestAppend(int N, int M) {
+static void TestAppend(int N, int M) {
TMyList l(N);
TMyList l2(M);
l.Append(l2);
diff --git a/util/generic/ptr.h b/util/generic/ptr.h
index 355ea932f8..19db0e3ec5 100644
--- a/util/generic/ptr.h
+++ b/util/generic/ptr.h
@@ -398,15 +398,15 @@ public:
Y_ASSERT(resultCount >= 0);
(void)resultCount;
}
-
+
TRefCounted(const TRefCounted&)
: Counter_(0)
{
}
-
+
void operator=(const TRefCounted&) {
}
-
+
private:
C Counter_;
};
@@ -459,10 +459,10 @@ public:
t->UnRef();
}
-
+
static inline void DecRef(T* t) noexcept {
Y_ASSERT(t);
-
+
t->DecRef();
}
@@ -571,10 +571,10 @@ public:
if (T_) {
Ops::DecRef(T_);
T_ = nullptr;
- }
+ }
return res;
}
-
+
inline long RefCount() const noexcept {
return T_ ? Ops::RefCount(T_) : 0;
}
diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp
index 0fdfb0d67e..c2dcff23f6 100644
--- a/util/generic/ptr_ut.cpp
+++ b/util/generic/ptr_ut.cpp
@@ -293,76 +293,76 @@ void TPointerTest::TestCopyPtr() {
UNIT_ASSERT_VALUES_EQUAL(cnt, 0);
}
-
+
class TOp: public TSimpleRefCount<TOp>, public TNonCopyable {
-public:
- static int Cnt;
+public:
+ static int Cnt;
-public:
- TOp() {
- ++Cnt;
- }
+public:
+ TOp() {
+ ++Cnt;
+ }
virtual ~TOp() {
- --Cnt;
- }
-};
-
-int TOp::Cnt = 0;
-
+ --Cnt;
+ }
+};
+
+int TOp::Cnt = 0;
+
class TOp2: public TOp {
-public:
- TIntrusivePtr<TOp> Op;
-
-public:
- TOp2(const TIntrusivePtr<TOp>& op)
- : Op(op)
- {
- ++Cnt;
- }
+public:
+ TIntrusivePtr<TOp> Op;
+
+public:
+ TOp2(const TIntrusivePtr<TOp>& op)
+ : Op(op)
+ {
+ ++Cnt;
+ }
~TOp2() override {
- --Cnt;
- }
-};
-
-class TOp3 {
-public:
- TIntrusivePtr<TOp2> Op2;
-};
-
-void Attach(TOp3* op3, TIntrusivePtr<TOp>* op) {
- TIntrusivePtr<TOp2> op2 = new TOp2(*op);
- op3->Op2 = op2.Get();
- *op = op2.Get();
-}
-
+ --Cnt;
+ }
+};
+
+class TOp3 {
+public:
+ TIntrusivePtr<TOp2> Op2;
+};
+
+void Attach(TOp3* op3, TIntrusivePtr<TOp>* op) {
+ TIntrusivePtr<TOp2> op2 = new TOp2(*op);
+ op3->Op2 = op2.Get();
+ *op = op2.Get();
+}
+
void TPointerTest::TestIntrPtr() {
- {
- TIntrusivePtr<TOp> p, p2;
- TOp3 op3;
- {
+ {
+ TIntrusivePtr<TOp> p, p2;
+ TOp3 op3;
+ {
TVector<TIntrusivePtr<TOp>> f1;
- {
+ {
TVector<TIntrusivePtr<TOp>> f2;
- f2.push_back(new TOp);
- p = new TOp;
- f2.push_back(p);
- Attach(&op3, &f2[1]);
- f1 = f2;
+ f2.push_back(new TOp);
+ p = new TOp;
+ f2.push_back(p);
+ Attach(&op3, &f2[1]);
+ f1 = f2;
UNIT_ASSERT_VALUES_EQUAL(f1[0]->RefCount(), 2);
UNIT_ASSERT_VALUES_EQUAL(f1[1]->RefCount(), 3);
- UNIT_ASSERT_EQUAL(f1[1].Get(), op3.Op2.Get());
+ UNIT_ASSERT_EQUAL(f1[1].Get(), op3.Op2.Get());
UNIT_ASSERT_VALUES_EQUAL(op3.Op2->RefCount(), 3);
UNIT_ASSERT_VALUES_EQUAL(op3.Op2->Op->RefCount(), 2);
UNIT_ASSERT_VALUES_EQUAL(TOp::Cnt, 4);
- }
- p2 = p;
- }
+ }
+ p2 = p;
+ }
UNIT_ASSERT_VALUES_EQUAL(op3.Op2->RefCount(), 1);
UNIT_ASSERT_VALUES_EQUAL(op3.Op2->Op->RefCount(), 3);
UNIT_ASSERT_VALUES_EQUAL(TOp::Cnt, 3);
- }
+ }
UNIT_ASSERT_VALUES_EQUAL(TOp::Cnt, 0);
-}
+}
namespace NTestIntrusiveConvertion {
struct TA: public TSimpleRefCount<TA> {
diff --git a/util/generic/refcount.h b/util/generic/refcount.h
index 538f295e58..966e853b77 100644
--- a/util/generic/refcount.h
+++ b/util/generic/refcount.h
@@ -2,7 +2,7 @@
#include <util/system/guard.h>
#include <util/system/atomic.h>
-#include <util/system/defaults.h>
+#include <util/system/defaults.h>
#include <util/system/yassert.h>
template <class TCounterCheckPolicy>
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index dc8ce69dbc..ab39fc7537 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -9,7 +9,7 @@
#include <util/charset/unidata.h>
#include <util/system/platform.h>
-#include <util/system/yassert.h>
+#include <util/system/yassert.h>
#include <contrib/libs/libc_compat/string.h>
diff --git a/util/generic/string.cpp b/util/generic/string.cpp
index 279fc4f865..3c655f1f66 100644
--- a/util/generic/string.cpp
+++ b/util/generic/string.cpp
@@ -69,17 +69,17 @@ TBasicString<wchar16, std::char_traits<wchar16>>::AppendUtf8(const ::TStringBuf&
template <>
bool TBasicString<wchar16, std::char_traits<wchar16>>::to_lower(size_t pos, size_t n) {
return ToLower(*this, pos, n);
-}
-
+}
+
template <>
bool TBasicString<wchar16, std::char_traits<wchar16>>::to_upper(size_t pos, size_t n) {
return ToUpper(*this, pos, n);
-}
-
+}
+
template <>
bool TBasicString<wchar16, std::char_traits<wchar16>>::to_title(size_t pos, size_t n) {
return ToTitle(*this, pos, n);
-}
+}
template <>
TUtf32String&
diff --git a/util/generic/string.h b/util/generic/string.h
index 7bff6fc224..8cd8aa6917 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -6,12 +6,12 @@
#include <stdexcept>
#include <string>
#include <string_view>
-
-#include <util/system/yassert.h>
+
+#include <util/system/yassert.h>
#include <util/system/atomic.h>
#include "ptr.h"
-#include "utility.h"
+#include "utility.h"
#include "bitops.h"
#include "explicit_type.h"
#include "reserve.h"
diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h
index 0701a6d6d8..44bb10bdeb 100644
--- a/util/generic/string_ut.h
+++ b/util/generic/string_ut.h
@@ -578,23 +578,23 @@ public:
// append family
s.append(Data.x());
UNIT_ASSERT(s == Data._0123456x());
-
+
#ifdef TSTRING_IS_STD_STRING
s.append(Data.xyz() + 1, 1);
#else
s.append(Data.xyz(), 1, 1);
#endif
UNIT_ASSERT(s == Data._0123456xy());
-
+
s.append(TStringType(Data.z()));
UNIT_ASSERT(s == Data._0123456xyz());
-
+
s.append(TStringType(Data.XYZ()), 2, 1);
UNIT_ASSERT(s == Data._0123456xyzZ());
-
+
s.append(*Data._0());
UNIT_ASSERT(s == Data._0123456xyzZ0());
-
+
// prepend family
s = Data._0123456xyz();
s.prepend(TStringType(Data.abc()));
@@ -649,7 +649,7 @@ public:
UNIT_ASSERT(s.at(s.size()) == 0);
UNIT_ASSERT(s[s.size()] == 0);
}
-
+
#ifndef TSTRING_IS_STD_STRING
void TestRefCount() {
using TStr = TStringType;
@@ -682,12 +682,12 @@ public:
UNIT_ASSERT(s.find(Data._345()) == 3);
UNIT_ASSERT(s.find(Data._345(), 5) == 10);
-
+
UNIT_ASSERT(s.find(Data._345(), 20) == TStringType::npos);
UNIT_ASSERT(s.find(*Data._3()) == 3);
UNIT_ASSERT(s.find(TStringType(Data._345())) == 3);
UNIT_ASSERT(s.find(TStringType(Data._345()), 2) == 3);
-
+
UNIT_ASSERT(s.find_first_of(TStringType(Data._389())) == 3);
UNIT_ASSERT(s.find_first_of(Data._389()) == 3);
UNIT_ASSERT(s.find_first_of(Data._389(), s.size()) == TStringType::npos);
@@ -696,7 +696,7 @@ public:
UNIT_ASSERT(s.find_first_of('1', 2) == 8);
UNIT_ASSERT(s.find_first_not_of('0') == 1);
UNIT_ASSERT(s.find_first_not_of('1', 1) == 2);
-
+
const TStringType rs = Data._0123401234();
UNIT_ASSERT(rs.rfind(*Data._3()) == 8);
@@ -720,8 +720,8 @@ public:
UNIT_ASSERT(s.rfind(TStringType(Data._345()), 6) == 3);
UNIT_ASSERT(s.rfind(TStringType(Data._345()), 3) == 3);
UNIT_ASSERT(s.rfind(TStringType(Data._345()), 2) == TStringType::npos);
- }
-
+ }
+
void TestContains() {
const TStringType s(Data._0123456_12345());
const TStringType s2(Data._0123());
@@ -743,7 +743,7 @@ public:
void TestOperators() {
TStringType s(Data._0123456());
-
+
// operator +=
s += TStringType(Data.x());
UNIT_ASSERT(s == Data._0123456x());
diff --git a/util/generic/vector.h b/util/generic/vector.h
index 92ec4488e9..a5b258955a 100644
--- a/util/generic/vector.h
+++ b/util/generic/vector.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "fwd.h"
#include "reserve.h"
@@ -129,4 +129,4 @@ public:
this->erase(this->begin() + size, this->end());
}
}
-};
+};
diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp
index a0a4e1c06c..cb3e29fed8 100644
--- a/util/generic/yexception_ut.cpp
+++ b/util/generic/yexception_ut.cpp
@@ -21,8 +21,8 @@ static inline void Throw2DontMove() {
#if defined(_MSC_VER)
#pragma warning(disable : 4702) /*unreachable code*/
-#endif
-
+#endif
+
static void CallbackFun(int i) {
throw i;
}
diff --git a/util/generic/ymath.cpp b/util/generic/ymath.cpp
index d713267537..31270728f4 100644
--- a/util/generic/ymath.cpp
+++ b/util/generic/ymath.cpp
@@ -8,7 +8,7 @@ float Exp2f(float x) {
return powf(2.0f, x);
}
-#ifdef _MSC_VER
+#ifdef _MSC_VER
double Erf(double x) {
static constexpr double _M_2_SQRTPI = 1.12837916709551257390;
diff --git a/util/generic/ymath.h b/util/generic/ymath.h
index 9ed3110211..9ff9ae2abe 100644
--- a/util/generic/ymath.h
+++ b/util/generic/ymath.h
@@ -68,7 +68,7 @@ static inline bool IsFinite(double f) {
#if defined(isfinite)
return isfinite(f);
#elif defined(_win_)
- return _finite(f) != 0;
+ return _finite(f) != 0;
#elif defined(_darwin_)
return isfinite(f);
#elif defined(__GNUC__)
@@ -82,7 +82,7 @@ static inline bool IsFinite(double f) {
static inline bool IsNan(double f) {
#if defined(_win_)
- return _isnan(f) != 0;
+ return _isnan(f) != 0;
#else
return std::isnan(f);
#endif
@@ -92,7 +92,7 @@ inline bool IsValidFloat(double f) {
return IsFinite(f) && !IsNan(f);
}
-#ifdef _MSC_VER
+#ifdef _MSC_VER
double Erf(double x);
#else
inline double Erf(double x) {