aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt
diff options
context:
space:
mode:
authormax42 <max42@yandex-team.ru>2022-02-10 16:47:51 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:51 +0300
commit9988f7c537b40605e1a0aaae2977d5f540425b83 (patch)
treea4f3497f66e2dcd82d0f7ae7573acd1320d1bc78 /library/cpp/yt
parent0a579de32b745908473b2cea7c5cd5540bc801f0 (diff)
downloadydb-9988f7c537b40605e1a0aaae2977d5f540425b83.tar.gz
Restoring authorship annotation for <max42@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yt')
-rw-r--r--library/cpp/yt/memory/intrusive_ptr.h2
-rw-r--r--library/cpp/yt/memory/new-inl.h16
-rw-r--r--library/cpp/yt/memory/range.h28
-rw-r--r--library/cpp/yt/memory/ref_counted.h2
-rw-r--r--library/cpp/yt/memory/weak_ptr.h38
-rw-r--r--library/cpp/yt/misc/guid.cpp36
-rw-r--r--library/cpp/yt/misc/guid.h12
-rw-r--r--library/cpp/yt/misc/port.h8
-rw-r--r--library/cpp/yt/string/format-inl.h42
-rw-r--r--library/cpp/yt/string/string.cpp6
-rw-r--r--library/cpp/yt/string/string.h10
-rw-r--r--library/cpp/yt/string/string_builder.h4
-rw-r--r--library/cpp/yt/yson_string/string.cpp8
-rw-r--r--library/cpp/yt/yson_string/string.h18
14 files changed, 115 insertions, 115 deletions
diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h
index 3dead7db1d..19ca6cb446 100644
--- a/library/cpp/yt/memory/intrusive_ptr.h
+++ b/library/cpp/yt/memory/intrusive_ptr.h
@@ -165,7 +165,7 @@ public:
T* operator->() const noexcept
{
YT_ASSERT(T_);
- return T_;
+ return T_;
}
explicit operator bool() const noexcept
diff --git a/library/cpp/yt/memory/new-inl.h b/library/cpp/yt/memory/new-inl.h
index 0a84818516..9f1d278cfe 100644
--- a/library/cpp/yt/memory/new-inl.h
+++ b/library/cpp/yt/memory/new-inl.h
@@ -43,7 +43,7 @@ struct TRefCountedWrapper final
~TRefCountedWrapper() = default;
- void DestroyRefCounted() override
+ void DestroyRefCounted() override
{
T::DestroyRefCountedImpl(this);
}
@@ -63,7 +63,7 @@ public:
~TRefCountedWrapperWithDeleter() = default;
- void DestroyRefCounted() override
+ void DestroyRefCounted() override
{
Deleter_(this);
}
@@ -84,7 +84,7 @@ struct TRefCountedWrapperWithCookie final
~TRefCountedWrapperWithCookie() = default;
- void DestroyRefCounted() override
+ void DestroyRefCounted() override
{
T::DestroyRefCountedImpl(this);
}
@@ -173,14 +173,14 @@ struct TConstructHelper<T, true>
template <class T, class... As>
Y_FORCE_INLINE TIntrusivePtr<T> SafeConstruct(void* ptr, As&&... args)
{
- try {
+ try {
auto* instance = TConstructHelper<T>::Construct(ptr, std::forward<As>(args)...);
return TIntrusivePtr<T>(instance, false);
- } catch (const std::exception& ex) {
- // Do not forget to free the memory.
+ } catch (const std::exception& ex) {
+ // Do not forget to free the memory.
TFreeMemory<T>::Do(ptr);
- throw;
- }
+ throw;
+ }
}
template <size_t Size, size_t Alignment>
diff --git a/library/cpp/yt/memory/range.h b/library/cpp/yt/memory/range.h
index 6c71aa9496..52bd649344 100644
--- a/library/cpp/yt/memory/range.h
+++ b/library/cpp/yt/memory/range.h
@@ -527,19 +527,19 @@ struct TIsPod<TMutableRange<T>>
} // namespace NYT
-template <class T>
-struct hash<NYT::TRange<T>>
-{
- size_t operator()(const NYT::TRange<T>& range) const
- {
- size_t result = 0;
- for (const auto& element : range) {
- NYT::HashCombine(result, element);
- }
- return result;
- }
-};
-
+template <class T>
+struct hash<NYT::TRange<T>>
+{
+ size_t operator()(const NYT::TRange<T>& range) const
+ {
+ size_t result = 0;
+ for (const auto& element : range) {
+ NYT::HashCombine(result, element);
+ }
+ return result;
+ }
+};
+
template <class T>
struct hash<NYT::TMutableRange<T>>
{
@@ -552,5 +552,5 @@ struct hash<NYT::TMutableRange<T>>
return result;
}
};
-
+
diff --git a/library/cpp/yt/memory/ref_counted.h b/library/cpp/yt/memory/ref_counted.h
index b683615b83..d51cc87439 100644
--- a/library/cpp/yt/memory/ref_counted.h
+++ b/library/cpp/yt/memory/ref_counted.h
@@ -19,7 +19,7 @@ public:
TRefCountedBase() = default;
// Make destructor protected
- virtual ~TRefCountedBase() noexcept = default;
+ virtual ~TRefCountedBase() noexcept = default;
virtual void DestroyRefCounted() = 0;
diff --git a/library/cpp/yt/memory/weak_ptr.h b/library/cpp/yt/memory/weak_ptr.h
index 25a242bb8a..900f8250b8 100644
--- a/library/cpp/yt/memory/weak_ptr.h
+++ b/library/cpp/yt/memory/weak_ptr.h
@@ -246,25 +246,25 @@ TWeakPtr<T> MakeWeak(const TIntrusivePtr<T>& p)
return TWeakPtr<T>(p);
}
-//! A helper for acquiring weak pointer for pointee, resetting intrusive pointer and then
-//! returning the pointee reference count using the acquired weak pointer.
-//! This helper is designed for best effort in checking that the object is not leaked after
-//! destructing (what seems to be) the last pointer to it.
-//! NB: it is possible to rewrite this helper making it working event with intrinsic refcounted objects,
-//! but it requires much nastier integration with the intrusive pointer destruction routines.
-template <typename T>
-int ResetAndGetResidualRefCount(TIntrusivePtr<T>& pointer)
-{
- auto weakPointer = MakeWeak(pointer);
- pointer.Reset();
- if (pointer = weakPointer.Lock()) {
- // This _may_ return 0 if we are again the only holder of the pointee.
- return pointer->GetRefCount() - 1;
- } else {
- return 0;
- }
-}
-
+//! A helper for acquiring weak pointer for pointee, resetting intrusive pointer and then
+//! returning the pointee reference count using the acquired weak pointer.
+//! This helper is designed for best effort in checking that the object is not leaked after
+//! destructing (what seems to be) the last pointer to it.
+//! NB: it is possible to rewrite this helper making it working event with intrinsic refcounted objects,
+//! but it requires much nastier integration with the intrusive pointer destruction routines.
+template <typename T>
+int ResetAndGetResidualRefCount(TIntrusivePtr<T>& pointer)
+{
+ auto weakPointer = MakeWeak(pointer);
+ pointer.Reset();
+ if (pointer = weakPointer.Lock()) {
+ // This _may_ return 0 if we are again the only holder of the pointee.
+ return pointer->GetRefCount() - 1;
+ } else {
+ return 0;
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// TODO(sandello): Kill comparsions.
diff --git a/library/cpp/yt/misc/guid.cpp b/library/cpp/yt/misc/guid.cpp
index 882787d7a2..025afa85dd 100644
--- a/library/cpp/yt/misc/guid.cpp
+++ b/library/cpp/yt/misc/guid.cpp
@@ -99,22 +99,22 @@ bool TGuid::FromString(TStringBuf str, TGuid* result)
return true;
}
-TGuid TGuid::FromStringHex32(TStringBuf str)
-{
- TGuid guid;
- if (!FromStringHex32(str, &guid)) {
+TGuid TGuid::FromStringHex32(TStringBuf str)
+{
+ TGuid guid;
+ if (!FromStringHex32(str, &guid)) {
throw TSimpleException(Sprintf("Error parsing Hex32 GUID \"%s\"",
TString(str).c_str()));
- }
- return guid;
-}
-
-bool TGuid::FromStringHex32(TStringBuf str, TGuid* result)
-{
- if (str.size() != 32) {
- return false;
- }
-
+ }
+ return guid;
+}
+
+bool TGuid::FromStringHex32(TStringBuf str, TGuid* result)
+{
+ if (str.size() != 32) {
+ return false;
+ }
+
bool ok = true;
int i = 0;
auto parseChar = [&] {
@@ -134,11 +134,11 @@ bool TGuid::FromStringHex32(TStringBuf str, TGuid* result)
for (size_t j = 0; j < 16; ++j) {
result->ReversedParts8[15 - j] = parseChar() * 16 + parseChar();
- }
-
+ }
+
return ok;
-}
-
+}
+
char* WriteGuidToBuffer(char* ptr, TGuid value)
{
auto writeHex1 = [&] (ui8 x) {
diff --git a/library/cpp/yt/misc/guid.h b/library/cpp/yt/misc/guid.h
index ec4ba3526a..303b6c31e7 100644
--- a/library/cpp/yt/misc/guid.h
+++ b/library/cpp/yt/misc/guid.h
@@ -70,12 +70,12 @@ struct TGuid
//! Parses guid from TStringBuf, returns |true| if everything was ok.
static bool FromString(TStringBuf str, TGuid* guid);
-
- //! Same as FromString, but expects exactly 32 hex digits without dashes.
- static TGuid FromStringHex32(TStringBuf str);
-
- //! Same as TryFromString, but expects exactly 32 hex digits without dashes.
- static bool FromStringHex32(TStringBuf str, TGuid* guid);
+
+ //! Same as FromString, but expects exactly 32 hex digits without dashes.
+ static TGuid FromStringHex32(TStringBuf str);
+
+ //! Same as TryFromString, but expects exactly 32 hex digits without dashes.
+ static bool FromStringHex32(TStringBuf str, TGuid* guid);
};
bool operator == (TGuid lhs, TGuid rhs);
diff --git a/library/cpp/yt/misc/port.h b/library/cpp/yt/misc/port.h
index b24ac50995..88f5b8930a 100644
--- a/library/cpp/yt/misc/port.h
+++ b/library/cpp/yt/misc/port.h
@@ -11,10 +11,10 @@
// various insightful information on memory usage and object creation patterns.
#define YT_ENABLE_REF_COUNTED_TRACKING
-// This define enables logging with TRACE level. You can still disable trace logging
-// for particular TU by discarding this macro identifier.
-#define YT_ENABLE_TRACE_LOGGING
-
+// This define enables logging with TRACE level. You can still disable trace logging
+// for particular TU by discarding this macro identifier.
+#define YT_ENABLE_TRACE_LOGGING
+
#ifndef NDEBUG
// This define enables thread affinity check -- a user-defined verification ensuring
// that some functions are called from particular threads.
diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h
index 5484d4a216..2e97c60049 100644
--- a/library/cpp/yt/string/format-inl.h
+++ b/library/cpp/yt/string/format-inl.h
@@ -85,11 +85,11 @@ inline void FormatValue(TStringBuilderBase* builder, TStringBuf value, TStringBu
if (singleQuotes || doubleQuotes) {
for (const char* valueCurrent = value.begin(); valueCurrent < value.end(); ++valueCurrent) {
char ch = *valueCurrent;
- if (ch == '\n') {
- builder->AppendString("\\n");
- } else if (ch == '\t') {
- builder->AppendString("\\t");
- } else if (ch < PrintableASCIILow || ch > PrintableASCIIHigh) {
+ if (ch == '\n') {
+ builder->AppendString("\\n");
+ } else if (ch == '\t') {
+ builder->AppendString("\\t");
+ } else if (ch < PrintableASCIILow || ch > PrintableASCIIHigh) {
builder->AppendString("\\x");
builder->AppendChar(Int2Hex[static_cast<ui8>(ch) >> 4]);
builder->AppendChar(Int2Hex[static_cast<ui8>(ch) & 0xf]);
@@ -288,10 +288,10 @@ struct TValueFormatter<TFormatterWrapper<TFormatter>>
};
// std::vector
-template <class T, class TAllocator>
-struct TValueFormatter<std::vector<T, TAllocator>>
+template <class T, class TAllocator>
+struct TValueFormatter<std::vector<T, TAllocator>>
{
- static void Do(TStringBuilderBase* builder, const std::vector<T, TAllocator>& collection, TStringBuf /*format*/)
+ static void Do(TStringBuilderBase* builder, const std::vector<T, TAllocator>& collection, TStringBuf /*format*/)
{
FormatRange(builder, collection, TDefaultFormatter());
}
@@ -398,20 +398,20 @@ struct TValueFormatter<TEnumIndexedVector<E, T>>
}
};
-// std::pair
-template <class T1, class T2>
-struct TValueFormatter<std::pair<T1, T2>>
-{
- static void Do(TStringBuilderBase* builder, const std::pair<T1, T2>& value, TStringBuf format)
- {
- builder->AppendChar('{');
- FormatValue(builder, value.first, format);
+// std::pair
+template <class T1, class T2>
+struct TValueFormatter<std::pair<T1, T2>>
+{
+ static void Do(TStringBuilderBase* builder, const std::pair<T1, T2>& value, TStringBuf format)
+ {
+ builder->AppendChar('{');
+ FormatValue(builder, value.first, format);
builder->AppendString(TStringBuf(", "));
- FormatValue(builder, value.second, format);
- builder->AppendChar('}');
- }
-};
-
+ FormatValue(builder, value.second, format);
+ builder->AppendChar('}');
+ }
+};
+
// std::optional
inline void FormatValue(TStringBuilderBase* builder, std::nullopt_t, TStringBuf /*format*/)
{
diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp
index 7440ac3fdd..e3734288e8 100644
--- a/library/cpp/yt/string/string.cpp
+++ b/library/cpp/yt/string/string.cpp
@@ -130,7 +130,7 @@ char* WriteSignedIntToBufferBackwardsImpl(char* ptr, T value, TStringBuf min)
// The negative value handling code below works incorrectly for min values.
if (value == std::numeric_limits<T>::min()) {
ptr -= min.length();
- ::memcpy(ptr, min.begin(), min.length());
+ ::memcpy(ptr, min.begin(), min.length());
return ptr;
}
@@ -144,7 +144,7 @@ char* WriteSignedIntToBufferBackwardsImpl(char* ptr, T value, TStringBuf min)
i64 rem = value % 100;
i64 quot = value / 100;
ptr -= 2;
- ::memcpy(ptr, &DecimalDigits2[rem], 2);
+ ::memcpy(ptr, &DecimalDigits2[rem], 2);
value = quot;
}
@@ -174,7 +174,7 @@ char* WriteUnsignedIntToBufferBackwardsImpl(char* ptr, T value)
i64 rem = value % 100;
i64 quot = value / 100;
ptr -= 2;
- ::memcpy(ptr, &DecimalDigits2[rem], 2);
+ ::memcpy(ptr, &DecimalDigits2[rem], 2);
value = quot;
}
diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h
index ae6c99caab..84dcc899fc 100644
--- a/library/cpp/yt/string/string.h
+++ b/library/cpp/yt/string/string.h
@@ -33,11 +33,11 @@ static constexpr TStringBuf DefaultJoinToStringDelimiter = ", ";
static constexpr TStringBuf DefaultKeyValueDelimiter = ": ";
static constexpr TStringBuf DefaultRangeEllipsisFormat = "...";
-// ASCII characters from 0x20 = ' ' to 0x7e = '~' are printable.
-static constexpr char PrintableASCIILow = 0x20;
-static constexpr char PrintableASCIIHigh = 0x7e;
-static constexpr TStringBuf Int2Hex = "0123456789abcdef";
-
+// ASCII characters from 0x20 = ' ' to 0x7e = '~' are printable.
+static constexpr char PrintableASCIILow = 0x20;
+static constexpr char PrintableASCIIHigh = 0x7e;
+static constexpr TStringBuf Int2Hex = "0123456789abcdef";
+
//! Joins a range of items into a string intermixing them with the delimiter.
/*!
* \param builder String builder where the output goes.
diff --git a/library/cpp/yt/string/string_builder.h b/library/cpp/yt/string/string_builder.h
index 0e13e70904..92a6959eef 100644
--- a/library/cpp/yt/string/string_builder.h
+++ b/library/cpp/yt/string/string_builder.h
@@ -68,8 +68,8 @@ public:
protected:
TString Buffer_;
- void DoReset() override;
- void DoPreallocate(size_t size) override;
+ void DoReset() override;
+ void DoPreallocate(size_t size) override;
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp
index 99d45e8616..5dcd32f864 100644
--- a/library/cpp/yt/yson_string/string.cpp
+++ b/library/cpp/yt/yson_string/string.cpp
@@ -38,10 +38,10 @@ TYsonStringBuf::TYsonStringBuf(TStringBuf data, EYsonType type)
, Null_(false)
{ }
-TYsonStringBuf::TYsonStringBuf(const char* data, EYsonType type)
- : TYsonStringBuf(TStringBuf(data), type)
-{ }
-
+TYsonStringBuf::TYsonStringBuf(const char* data, EYsonType type)
+ : TYsonStringBuf(TStringBuf(data), type)
+{ }
+
TYsonStringBuf::operator bool() const
{
return !Null_;
diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h
index e13af37a6d..612aa6248c 100644
--- a/library/cpp/yt/yson_string/string.h
+++ b/library/cpp/yt/yson_string/string.h
@@ -21,23 +21,23 @@ public:
//! Constructs an instance from TYsonString.
TYsonStringBuf(const TYsonString& ysonString);
- //! Constructs a non-null instance with given type and content.
+ //! Constructs a non-null instance with given type and content.
explicit TYsonStringBuf(
const TString& data,
EYsonType type = EYsonType::Node);
- //! Constructs a non-null instance with given type and content.
+ //! Constructs a non-null instance with given type and content.
explicit TYsonStringBuf(
TStringBuf data,
EYsonType type = EYsonType::Node);
- //! Constructs a non-null instance with given type and content
- //! (without this overload there is no way to construct TYsonStringBuf from
- //! string literal).
- explicit TYsonStringBuf(
- const char* data,
- EYsonType type = EYsonType::Node);
-
+ //! Constructs a non-null instance with given type and content
+ //! (without this overload there is no way to construct TYsonStringBuf from
+ //! string literal).
+ explicit TYsonStringBuf(
+ const char* data,
+ EYsonType type = EYsonType::Node);
+
//! Returns |true| if the instance is not null.
explicit operator bool() const;