aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorignat <ignat@yandex-team.ru>2022-02-10 16:48:20 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:20 +0300
commit12d7840a194f4a6e4ea77a405f980074cf43e942 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8
parentc8b279dd21ddcb47e755028d81281f113a0f4a11 (diff)
downloadydb-12d7840a194f4a6e4ea77a405f980074cf43e942.tar.gz
Restoring authorship annotation for <ignat@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--build/plugins/pybuild.py8
-rw-r--r--build/ymake.core.conf26
-rw-r--r--contrib/python/ya.make2
-rw-r--r--contrib/tools/python3/src/Lib/ctypes/__init__.py4
-rw-r--r--contrib/tools/python3/src/Lib/doctest.py10
-rw-r--r--library/cpp/yson/node/node.cpp6
-rw-r--r--library/cpp/yson/node/node.h4
-rw-r--r--library/cpp/yt/coding/varint-inl.h38
-rw-r--r--library/cpp/yt/coding/varint.h8
-rw-r--r--library/cpp/yt/memory/blob.cpp18
-rw-r--r--library/cpp/yt/memory/blob.h12
-rw-r--r--library/cpp/yt/memory/intrusive_ptr.h10
-rw-r--r--library/cpp/yt/memory/ref.cpp22
-rw-r--r--library/cpp/yt/memory/ref.h192
-rw-r--r--library/cpp/yt/memory/weak_ptr.h2
-rw-r--r--library/cpp/yt/misc/guid-inl.h6
-rw-r--r--library/cpp/yt/misc/guid.cpp256
-rw-r--r--library/cpp/yt/misc/guid.h16
-rw-r--r--library/cpp/yt/misc/hash.h34
-rw-r--r--library/cpp/yt/misc/unittests/enum_ut.cpp4
-rw-r--r--library/cpp/yt/misc/unittests/guid_ut.cpp4
-rw-r--r--library/cpp/yt/misc/unittests/ya.make4
-rw-r--r--library/cpp/yt/misc/ya.make2
-rw-r--r--library/cpp/yt/small_containers/compact_set-inl.h4
-rw-r--r--library/cpp/yt/small_containers/compact_set.h4
-rw-r--r--library/cpp/yt/small_containers/unittests/compact_set_ut.cpp4
-rw-r--r--library/cpp/yt/small_containers/unittests/ya.make24
-rw-r--r--library/cpp/yt/small_containers/ya.make36
-rw-r--r--library/cpp/yt/string/enum.cpp12
-rw-r--r--library/cpp/yt/string/enum.h6
-rw-r--r--library/cpp/yt/string/format-inl.h228
-rw-r--r--library/cpp/yt/string/guid.cpp42
-rw-r--r--library/cpp/yt/string/guid.h28
-rw-r--r--library/cpp/yt/string/string.cpp260
-rw-r--r--library/cpp/yt/string/string.h36
-rw-r--r--library/cpp/yt/string/string_builder-inl.h10
-rw-r--r--library/cpp/yt/string/unittests/enum_ut.cpp8
-rw-r--r--library/cpp/yt/string/unittests/format_ut.cpp4
-rw-r--r--library/cpp/yt/string/unittests/guid_ut.cpp8
-rw-r--r--library/cpp/yt/string/unittests/string_ut.cpp2
-rw-r--r--library/cpp/yt/string/unittests/ya.make32
-rw-r--r--library/cpp/yt/string/ya.make52
-rw-r--r--library/cpp/yt/yson_string/string.cpp2
-rw-r--r--library/cpp/yt/yson_string/string.h2
-rw-r--r--library/python/pytest/plugins/ya.py4
45 files changed, 748 insertions, 748 deletions
diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py
index 3913a456be..f32a2d39a0 100644
--- a/build/plugins/pybuild.py
+++ b/build/plugins/pybuild.py
@@ -209,10 +209,10 @@ def onpy_srcs(unit, *args):
if unit_needs_main:
py_program(unit, py3)
- py_namespace_value = unit.get('PY_NAMESPACE_VALUE')
- if py_namespace_value == ".":
- ns = ""
- else:
+ py_namespace_value = unit.get('PY_NAMESPACE_VALUE')
+ if py_namespace_value == ".":
+ ns = ""
+ else:
ns = (unit.get('PY_NAMESPACE_VALUE') or upath.replace('/', '.')) + '.'
cython_coverage = unit.get('CYTHON_COVERAGE') == 'yes'
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index c6def02d48..081833998b 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -8819,26 +8819,26 @@ multimodule PY23_LIBRARY {
###
### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
multimodule PY23_NATIVE_LIBRARY {
- module PY2: LIBRARY {
+ module PY2: LIBRARY {
.RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL
- OBJ_SUF=.py2
+ OBJ_SUF=.py2
PYTHON2_ADDINCL()
SET(MODULE_LANG PY2)
- }
- module PY3: LIBRARY {
+ }
+ module PY3: LIBRARY {
.RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3
.ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
PYTHON3_ADDINCL()
SET(MODULE_LANG PY3)
- when ($MSVC == "yes" || $CYGWIN == "yes") {
- MODULE_PREFIX=py3c
- }
- otherwise {
- MODULE_PREFIX=libpy3c
- }
- OBJ_SUF=.py3
- }
-}
+ when ($MSVC == "yes" || $CYGWIN == "yes") {
+ MODULE_PREFIX=py3c
+ }
+ otherwise {
+ MODULE_PREFIX=libpy3c
+ }
+ OBJ_SUF=.py3
+ }
+}
IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
# tag:src-processing
diff --git a/contrib/python/ya.make b/contrib/python/ya.make
index 73e6ed3993..d01ced9f3a 100644
--- a/contrib/python/ya.make
+++ b/contrib/python/ya.make
@@ -211,7 +211,7 @@ RECURSE(
dictpath
diff-match-patch
directio
- distro
+ distro
django
django-admin-inline-paginator
django-admin-rangefilter
diff --git a/contrib/tools/python3/src/Lib/ctypes/__init__.py b/contrib/tools/python3/src/Lib/ctypes/__init__.py
index 6cdc87b81f..2dde747beb 100644
--- a/contrib/tools/python3/src/Lib/ctypes/__init__.py
+++ b/contrib/tools/python3/src/Lib/ctypes/__init__.py
@@ -371,8 +371,8 @@ class CDLL(object):
_restype_ = self._func_restype_
self._FuncPtr = _FuncPtr
- self._builtin = {}
-
+ self._builtin = {}
+
if handle is None:
if isinstance(self._name, dict):
self._builtin = self._name['symbols']
diff --git a/contrib/tools/python3/src/Lib/doctest.py b/contrib/tools/python3/src/Lib/doctest.py
index 8f083e425b..2910bebd8d 100644
--- a/contrib/tools/python3/src/Lib/doctest.py
+++ b/contrib/tools/python3/src/Lib/doctest.py
@@ -956,7 +956,7 @@ class DocTestFinder:
elif inspect.isfunction(object):
return module.__dict__ is object.__globals__
elif inspect.ismethoddescriptor(object):
- if hasattr(object, '__objclass__') and hasattr(object.__objclass__, '__module__'):
+ if hasattr(object, '__objclass__') and hasattr(object.__objclass__, '__module__'):
obj_mod = object.__objclass__.__module__
elif hasattr(object, '__module__'):
obj_mod = object.__module__
@@ -964,10 +964,10 @@ class DocTestFinder:
return True # [XX] no easy way to tell otherwise
return module.__name__ == obj_mod
elif inspect.isclass(object):
- try:
- return module.__name__ == object.__module__
- except:
- return True
+ try:
+ return module.__name__ == object.__module__
+ except:
+ return True
elif hasattr(object, '__module__'):
return module.__name__ == object.__module__
elif isinstance(object, property):
diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp
index e2acc4cdd4..b39e070718 100644
--- a/library/cpp/yson/node/node.cpp
+++ b/library/cpp/yson/node/node.cpp
@@ -9,7 +9,7 @@
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
-
+
bool TNode::TNull::operator==(const TNull&) const {
return true;
}
@@ -905,8 +905,8 @@ bool GetBool(const TNode& node)
} else if (node.IsString()) {
return node.AsString() == "true";
} else {
- ythrow TNode::TTypeError()
- << "GetBool(): not a boolean or string type";
+ ythrow TNode::TTypeError()
+ << "GetBool(): not a boolean or string type";
}
}
diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h
index 12e8a127e1..5f90f95df0 100644
--- a/library/cpp/yson/node/node.h
+++ b/library/cpp/yson/node/node.h
@@ -8,7 +8,7 @@
#include <util/generic/yexception.h>
#include <util/generic/ylimits.h>
#include <util/string/cast.h>
-
+
#include <cmath>
#include <variant>
@@ -27,7 +27,7 @@ public:
{ };
class TTypeError
- : public TWithBackTrace<yexception>
+ : public TWithBackTrace<yexception>
{ };
enum EType {
diff --git a/library/cpp/yt/coding/varint-inl.h b/library/cpp/yt/coding/varint-inl.h
index 9c811ab661..f0a09e9d30 100644
--- a/library/cpp/yt/coding/varint-inl.h
+++ b/library/cpp/yt/coding/varint-inl.h
@@ -1,9 +1,9 @@
-#ifndef VARINT_INL_H_
-#error "Direct inclusion of this file is not allowed, include varint.h"
+#ifndef VARINT_INL_H_
+#error "Direct inclusion of this file is not allowed, include varint.h"
// For the sake of sane code completion.
#include "varint.h"
-#endif
-
+#endif
+
#include "zig_zag.h"
namespace NYT {
@@ -11,13 +11,13 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
template <class TWriteCallback>
-Y_FORCE_INLINE int WriteVarUint64Impl(TWriteCallback doWrite, ui64 value)
+Y_FORCE_INLINE int WriteVarUint64Impl(TWriteCallback doWrite, ui64 value)
{
bool stop = false;
int bytesWritten = 0;
while (!stop) {
++bytesWritten;
- ui8 byte = static_cast<ui8>(value | 0x80);
+ ui8 byte = static_cast<ui8>(value | 0x80);
value >>= 7;
if (value == 0) {
stop = true;
@@ -36,17 +36,17 @@ Y_FORCE_INLINE int WriteVarUint64(IOutputStream* output, ui64 value)
}, value);
}
-Y_FORCE_INLINE int WriteVarUint64(char* output, ui64 value)
+Y_FORCE_INLINE int WriteVarUint64(char* output, ui64 value)
{
return WriteVarUint64Impl([&] (ui8 byte) {
- *output++ = byte;
+ *output++ = byte;
}, value);
}
////////////////////////////////////////////////////////////////////////////////
template <class TOutput>
-Y_FORCE_INLINE int WriteVarUint32Impl(TOutput output, ui32 value)
+Y_FORCE_INLINE int WriteVarUint32Impl(TOutput output, ui32 value)
{
return WriteVarUint64(output, static_cast<ui64>(value));
}
@@ -56,7 +56,7 @@ Y_FORCE_INLINE int WriteVarUint32(IOutputStream* output, ui32 value)
return WriteVarUint32Impl(output, value);
}
-Y_FORCE_INLINE int WriteVarUint32(char* output, ui32 value)
+Y_FORCE_INLINE int WriteVarUint32(char* output, ui32 value)
{
return WriteVarUint32Impl(output, value);
}
@@ -64,7 +64,7 @@ Y_FORCE_INLINE int WriteVarUint32(char* output, ui32 value)
////////////////////////////////////////////////////////////////////////////////
template <class TOutput>
-Y_FORCE_INLINE int WriteVarInt32Impl(TOutput output, i32 value)
+Y_FORCE_INLINE int WriteVarInt32Impl(TOutput output, i32 value)
{
return WriteVarUint64(output, static_cast<ui64>(ZigZagEncode32(value)));
}
@@ -74,7 +74,7 @@ Y_FORCE_INLINE int WriteVarInt32(IOutputStream* output, i32 value)
return WriteVarInt32Impl(output, value);
}
-Y_FORCE_INLINE int WriteVarInt32(char* output, i32 value)
+Y_FORCE_INLINE int WriteVarInt32(char* output, i32 value)
{
return WriteVarInt32Impl(output, value);
}
@@ -82,7 +82,7 @@ Y_FORCE_INLINE int WriteVarInt32(char* output, i32 value)
////////////////////////////////////////////////////////////////////////////////
template <class TOutput>
-Y_FORCE_INLINE int WriteVarInt64Impl(TOutput output, i64 value)
+Y_FORCE_INLINE int WriteVarInt64Impl(TOutput output, i64 value)
{
return WriteVarUint64(output, static_cast<ui64>(ZigZagEncode64(value)));
}
@@ -92,7 +92,7 @@ Y_FORCE_INLINE int WriteVarInt64(IOutputStream* output, i64 value)
return WriteVarInt64Impl(output, value);
}
-Y_FORCE_INLINE int WriteVarInt64(char* output, i64 value)
+Y_FORCE_INLINE int WriteVarInt64(char* output, i64 value)
{
return WriteVarInt64Impl(output, value);
}
@@ -100,7 +100,7 @@ Y_FORCE_INLINE int WriteVarInt64(char* output, i64 value)
////////////////////////////////////////////////////////////////////////////////
template <class TReadCallback>
-Y_FORCE_INLINE int ReadVarUint64Impl(TReadCallback doRead, ui64* value)
+Y_FORCE_INLINE int ReadVarUint64Impl(TReadCallback doRead, ui64* value)
{
size_t count = 0;
ui64 result = 0;
@@ -130,7 +130,7 @@ Y_FORCE_INLINE int ReadVarUint64(IInputStream* input, ui64* value)
}, value);
}
-Y_FORCE_INLINE int ReadVarUint64(const char* input, ui64* value)
+Y_FORCE_INLINE int ReadVarUint64(const char* input, ui64* value)
{
return ReadVarUint64Impl([&] () {
char byte = *input;
@@ -170,7 +170,7 @@ Y_FORCE_INLINE int ReadVarUint32(IInputStream* input, ui32* value)
return ReadVarUint32Impl(value, input);
}
-Y_FORCE_INLINE int ReadVarUint32(const char* input, ui32* value)
+Y_FORCE_INLINE int ReadVarUint32(const char* input, ui32* value)
{
return ReadVarUint32Impl(value, input);
}
@@ -199,7 +199,7 @@ Y_FORCE_INLINE int ReadVarInt32(IInputStream* input, i32* value)
return ReadVarInt32Impl(value, input);
}
-Y_FORCE_INLINE int ReadVarInt32(const char* input, i32* value)
+Y_FORCE_INLINE int ReadVarInt32(const char* input, i32* value)
{
return ReadVarInt32Impl(value, input);
}
@@ -225,7 +225,7 @@ Y_FORCE_INLINE int ReadVarInt64(IInputStream* input, i64* value)
return ReadVarInt64Impl(value, input);
}
-Y_FORCE_INLINE int ReadVarInt64(const char* input, i64* value)
+Y_FORCE_INLINE int ReadVarInt64(const char* input, i64* value)
{
return ReadVarInt64Impl(value, input);
}
diff --git a/library/cpp/yt/coding/varint.h b/library/cpp/yt/coding/varint.h
index d5c607b497..c5399f8b06 100644
--- a/library/cpp/yt/coding/varint.h
+++ b/library/cpp/yt/coding/varint.h
@@ -50,7 +50,7 @@ int ReadVarInt64(const char* input, const char* end, i64* value);
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
-
-#define VARINT_INL_H_
-#include "varint-inl.h"
-#undef VARINT_INL_H_
+
+#define VARINT_INL_H_
+#include "varint-inl.h"
+#undef VARINT_INL_H_
diff --git a/library/cpp/yt/memory/blob.cpp b/library/cpp/yt/memory/blob.cpp
index d67630d37b..86000b033b 100644
--- a/library/cpp/yt/memory/blob.cpp
+++ b/library/cpp/yt/memory/blob.cpp
@@ -206,19 +206,19 @@ void TBlob::SetTagCookie(const TBlob& other)
#endif
}
-void swap(TBlob& left, TBlob& right)
-{
- if (&left != &right) {
- std::swap(left.Begin_, right.Begin_);
- std::swap(left.Size_, right.Size_);
- std::swap(left.Capacity_, right.Capacity_);
+void swap(TBlob& left, TBlob& right)
+{
+ if (&left != &right) {
+ std::swap(left.Begin_, right.Begin_);
+ std::swap(left.Size_, right.Size_);
+ std::swap(left.Capacity_, right.Capacity_);
std::swap(left.PageAligned_, right.PageAligned_);
#ifdef YT_ENABLE_REF_COUNTED_TRACKING
std::swap(left.TagCookie_, right.TagCookie_);
#endif
- }
-}
-
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
diff --git a/library/cpp/yt/memory/blob.h b/library/cpp/yt/memory/blob.h
index 0fe1bcbd11..99441fb8c9 100644
--- a/library/cpp/yt/memory/blob.h
+++ b/library/cpp/yt/memory/blob.h
@@ -187,11 +187,11 @@ public:
//! Appends a single char to the end.
void Append(char ch);
- //! Swaps the current and other instances
- void Swap(TBlob& other);
+ //! Swaps the current and other instances
+ void Swap(TBlob& other);
+
+ friend void swap(TBlob& left, TBlob& right);
- friend void swap(TBlob& left, TBlob& right);
-
private:
char* Begin_ = nullptr;
size_t Size_ = 0;
@@ -213,8 +213,8 @@ private:
void SetTagCookie(const TBlob& other);
};
-void swap(TBlob& left, TBlob& right);
-
+void swap(TBlob& left, TBlob& right);
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h
index 76b8f55fb4..3dead7db1d 100644
--- a/library/cpp/yt/memory/intrusive_ptr.h
+++ b/library/cpp/yt/memory/intrusive_ptr.h
@@ -3,11 +3,11 @@
#include "ref_counted.h"
#include <util/generic/hash.h>
-#include <util/generic/utility.h>
-
-#include <utility>
+#include <util/generic/utility.h>
+
+#include <utility>
#include <type_traits>
-
+
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
@@ -110,7 +110,7 @@ public:
}
//! Move assignment operator.
- TIntrusivePtr& operator=(TIntrusivePtr&& other) noexcept
+ TIntrusivePtr& operator=(TIntrusivePtr&& other) noexcept
{
TIntrusivePtr(std::move(other)).Swap(*this);
return *this;
diff --git a/library/cpp/yt/memory/ref.cpp b/library/cpp/yt/memory/ref.cpp
index c84a1f3f96..e8ff42e976 100644
--- a/library/cpp/yt/memory/ref.cpp
+++ b/library/cpp/yt/memory/ref.cpp
@@ -5,8 +5,8 @@
#include <util/system/info.h>
-namespace NYT {
-
+namespace NYT {
+
////////////////////////////////////////////////////////////////////////////////
namespace NDetail {
@@ -275,20 +275,20 @@ TString ToString(TRef ref)
}
TString ToString(const TMutableRef& ref)
-{
- return ToString(TRef(ref));
-}
-
+{
+ return ToString(TRef(ref));
+}
+
TString ToString(const TSharedRef& ref)
{
return ToString(TRef(ref));
}
TString ToString(const TSharedMutableRef& ref)
-{
- return ToString(TRef(ref));
-}
-
+{
+ return ToString(TRef(ref));
+}
+
size_t GetPageSize()
{
static const size_t PageSize = NSystemInfo::GetPageSize();
@@ -375,4 +375,4 @@ TSharedRefArray TSharedRefArrayBuilder::Finish()
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYT
+} // namespace NYT
diff --git a/library/cpp/yt/memory/ref.h b/library/cpp/yt/memory/ref.h
index d89fca702c..73d19d9013 100644
--- a/library/cpp/yt/memory/ref.h
+++ b/library/cpp/yt/memory/ref.h
@@ -1,7 +1,7 @@
#pragma once
#include "new.h"
-#include "range.h"
+#include "range.h"
#include "shared_range.h"
#include <type_traits>
@@ -13,80 +13,80 @@ namespace NYT {
// Forward declaration.
class TBlob;
-//! A non-owning reference to a range of memory.
+//! A non-owning reference to a range of memory.
class TRef
- : public TRange<char>
+ : public TRange<char>
{
public:
- //! Creates a null TRef.
+ //! Creates a null TRef.
TRef() = default;
- //! Creates a TRef for a given block of memory.
+ //! Creates a TRef for a given block of memory.
TRef(const void* data, size_t size);
- //! Creates a TRef for a given range of memory.
+ //! Creates a TRef for a given range of memory.
TRef(const void* begin, const void* end);
//! Creates an empty TRef.
static TRef MakeEmpty();
- //! Creates a non-owning TRef for a given blob.
+ //! Creates a non-owning TRef for a given blob.
static TRef FromBlob(const TBlob& blob);
- //! Creates a non-owning TRef for a given string.
+ //! Creates a non-owning TRef for a given string.
static TRef FromString(const TString& str);
//! Creates a non-owning TRef for a given stringbuf.
static TRef FromStringBuf(TStringBuf strBuf);
- //! Creates a non-owning TRef for a given pod structure.
+ //! Creates a non-owning TRef for a given pod structure.
template <class T>
static TRef FromPod(const T& data);
-
- //! Creates a TRef for a part of existing range.
+
+ //! Creates a TRef for a part of existing range.
TRef Slice(size_t startOffset, size_t endOffset) const;
- //! Compares the content for bitwise equality.
+ //! Compares the content for bitwise equality.
static bool AreBitwiseEqual(TRef lhs, TRef rhs);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-//! A non-owning reference to a mutable range of memory.
-//! Use with caution :)
-class TMutableRef
- : public TMutableRange<char>
-{
-public:
- //! Creates a null TMutableRef.
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+//! A non-owning reference to a mutable range of memory.
+//! Use with caution :)
+class TMutableRef
+ : public TMutableRange<char>
+{
+public:
+ //! Creates a null TMutableRef.
//! Note empty TMutableRef is not the same as null TMutableRef.
//! `operator bool` can be used to check if ref is nonnull.
TMutableRef() = default;
-
- //! Creates a TMutableRef for a given block of memory.
+
+ //! Creates a TMutableRef for a given block of memory.
TMutableRef(void* data, size_t size);
-
- //! Creates a TMutableRef for a given range of memory.
+
+ //! Creates a TMutableRef for a given range of memory.
TMutableRef(void* begin, void* end);
-
+
//! Creates an empty TMutableRef.
static TMutableRef MakeEmpty();
- //! Converts a TMutableRef to TRef.
+ //! Converts a TMutableRef to TRef.
operator TRef() const;
- //! Creates a non-owning TMutableRef for a given blob.
+ //! Creates a non-owning TMutableRef for a given blob.
static TMutableRef FromBlob(TBlob& blob);
- //! Creates a non-owning TMutableRef for a given pod structure.
- template <class T>
+ //! Creates a non-owning TMutableRef for a given pod structure.
+ template <class T>
static TMutableRef FromPod(T& data);
- //! Creates a non-owning TMutableRef for a given string.
- //! Ensures that the string is not shared.
+ //! Creates a non-owning TMutableRef for a given string.
+ //! Ensures that the string is not shared.
static TMutableRef FromString(TString& str);
- //! Creates a TMutableRef for a part of existing range.
+ //! Creates a TMutableRef for a part of existing range.
TMutableRef Slice(size_t startOffset, size_t endOffset) const;
};
@@ -101,16 +101,16 @@ struct TDefaultSharedBlobTag { };
//! A reference to a range of memory with shared ownership.
class TSharedRef
- : public TSharedRange<char>
+ : public TSharedRange<char>
{
public:
- //! Creates a null TSharedRef.
+ //! Creates a null TSharedRef.
TSharedRef() = default;
- //! Creates a TSharedRef with a given holder.
+ //! Creates a TSharedRef with a given holder.
TSharedRef(TRef ref, THolderPtr holder);
- //! Creates a TSharedRef from a pointer and length.
+ //! Creates a TSharedRef from a pointer and length.
TSharedRef(const void* data, size_t length, THolderPtr holder);
//! Creates a TSharedRef from a range.
@@ -119,39 +119,39 @@ public:
//! Creates an empty TSharedRef.
static TSharedRef MakeEmpty();
- //! Converts a TSharedRef to TRef.
+ //! Converts a TSharedRef to TRef.
operator TRef() const;
- //! Creates a TSharedRef from a string.
+ //! Creates a TSharedRef from a string.
//! Since strings are ref-counted, no data is copied.
//! The memory is marked with a given tag.
template <class TTag>
static TSharedRef FromString(TString str);
- //! Creates a TSharedRef from a string.
+ //! Creates a TSharedRef from a string.
//! Since strings are ref-counted, no data is copied.
//! The memory is marked with TDefaultSharedBlobTag.
static TSharedRef FromString(TString str);
- //! Creates a TSharedRef reference from a string.
+ //! Creates a TSharedRef reference from a string.
//! Since strings are ref-counted, no data is copied.
//! The memory is marked with a given tag.
static TSharedRef FromString(TString str, TRefCountedTypeCookie tagCookie);
- //! Creates a TSharedRef for a given blob taking ownership of its content.
+ //! Creates a TSharedRef for a given blob taking ownership of its content.
static TSharedRef FromBlob(TBlob&& blob);
- //! Creates a copy of a given TRef.
- //! The memory is marked with a given tag.
+ //! Creates a copy of a given TRef.
+ //! The memory is marked with a given tag.
static TSharedRef MakeCopy(TRef ref, TRefCountedTypeCookie tagCookie);
-
- //! Creates a copy of a given TRef.
- //! The memory is marked with a given tag.
- template <class TTag>
+
+ //! Creates a copy of a given TRef.
+ //! The memory is marked with a given tag.
+ template <class TTag>
static TSharedRef MakeCopy(TRef ref);
- //! Creates a TSharedRef for a part of existing range.
+ //! Creates a TSharedRef for a part of existing range.
TSharedRef Slice(size_t startOffset, size_t endOffset) const;
//! Creates a TSharedRef for a part of existing range.
@@ -160,54 +160,54 @@ public:
//! Creates a vector of slices with specified size.
std::vector<TSharedRef> Split(size_t partSize) const;
-private:
+private:
friend class TSharedRefArrayImpl;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-//! A reference to a mutable range of memory with shared ownership.
-//! Use with caution :)
-class TSharedMutableRef
- : public TSharedMutableRange<char>
-{
-public:
- //! Creates a null TSharedMutableRef.
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+//! A reference to a mutable range of memory with shared ownership.
+//! Use with caution :)
+class TSharedMutableRef
+ : public TSharedMutableRange<char>
+{
+public:
+ //! Creates a null TSharedMutableRef.
TSharedMutableRef() = default;
-
- //! Creates a TSharedMutableRef with a given holder.
+
+ //! Creates a TSharedMutableRef with a given holder.
TSharedMutableRef(const TMutableRef& ref, THolderPtr holder);
-
- //! Creates a TSharedMutableRef from a pointer and length.
+
+ //! Creates a TSharedMutableRef from a pointer and length.
TSharedMutableRef(void* data, size_t length, THolderPtr holder);
-
+
//! Creates a TSharedMutableRef from a range.
TSharedMutableRef(void* begin, void* end, THolderPtr holder);
-
+
//! Creates an empty TSharedMutableRef.
static TSharedMutableRef MakeEmpty();
- //! Converts a TSharedMutableRef to TMutableRef.
+ //! Converts a TSharedMutableRef to TMutableRef.
operator TMutableRef() const;
- //! Converts a TSharedMutableRef to TSharedRef.
+ //! Converts a TSharedMutableRef to TSharedRef.
operator TSharedRef() const;
- //! Converts a TSharedMutableRef to TRef.
+ //! Converts a TSharedMutableRef to TRef.
operator TRef() const;
-
- //! Allocates a new shared block of memory.
- //! The memory is marked with a given tag.
- template <class TTag>
+
+ //! Allocates a new shared block of memory.
+ //! The memory is marked with a given tag.
+ template <class TTag>
static TSharedMutableRef Allocate(size_t size, bool initializeStorage = true);
- //! Allocates a new shared block of memory.
- //! The memory is marked with TDefaultSharedBlobTag.
+ //! Allocates a new shared block of memory.
+ //! The memory is marked with TDefaultSharedBlobTag.
static TSharedMutableRef Allocate(size_t size, bool initializeStorage = true);
- //! Allocates a new shared block of memory.
- //! The memory is marked with a given tag.
+ //! Allocates a new shared block of memory.
+ //! The memory is marked with a given tag.
static TSharedMutableRef Allocate(size_t size, bool initializeStorage, TRefCountedTypeCookie tagCookie);
//! Allocates a new page aligned shared block of memory.
@@ -226,22 +226,22 @@ public:
//! The memory is marked with a given tag.
static TSharedMutableRef AllocatePageAligned(size_t size, bool initializeStorage, TRefCountedTypeCookie tagCookie);
- //! Creates a TSharedMutableRef for the whole blob taking ownership of its content.
+ //! Creates a TSharedMutableRef for the whole blob taking ownership of its content.
static TSharedMutableRef FromBlob(TBlob&& blob);
- //! Creates a copy of a given TRef.
- //! The memory is marked with a given tag.
+ //! Creates a copy of a given TRef.
+ //! The memory is marked with a given tag.
static TSharedMutableRef MakeCopy(TRef ref, TRefCountedTypeCookie tagCookie);
- //! Creates a copy of a given TRef.
- //! The memory is marked with a given tag.
- template <class TTag>
+ //! Creates a copy of a given TRef.
+ //! The memory is marked with a given tag.
+ template <class TTag>
static TSharedMutableRef MakeCopy(TRef ref);
- //! Creates a reference for a part of existing range.
+ //! Creates a reference for a part of existing range.
TSharedMutableRef Slice(size_t startOffset, size_t endOffset) const;
- //! Creates a reference for a part of existing range.
+ //! Creates a reference for a part of existing range.
TSharedMutableRef Slice(void* begin, void* end) const;
};
@@ -270,13 +270,13 @@ public:
template <class TParts>
TSharedRefArray(TParts&& parts, TMoveParts);
- TSharedRefArray& operator = (const TSharedRefArray& other);
- TSharedRefArray& operator = (TSharedRefArray&& other);
+ TSharedRefArray& operator = (const TSharedRefArray& other);
+ TSharedRefArray& operator = (TSharedRefArray&& other);
explicit operator bool() const;
- void Reset();
-
+ void Reset();
+
size_t Size() const;
size_t size() const;
i64 ByteSize() const;
@@ -303,7 +303,7 @@ private:
As&&... args);
};
-// STL interop.
+// STL interop.
const TSharedRef* begin(const TSharedRefArray& array);
const TSharedRef* end(const TSharedRefArray& array);
@@ -364,17 +364,17 @@ TString ToString(TRef ref);
TString ToString(const TMutableRef& ref);
TString ToString(const TSharedRef& ref);
TString ToString(const TSharedMutableRef& ref);
-
+
size_t GetPageSize();
size_t RoundUpToPage(size_t bytes);
size_t GetByteSize(TRef ref);
size_t GetByteSize(const TSharedRefArray& array);
-template <class T>
+template <class T>
size_t GetByteSize(TRange<T> parts);
template <class T>
size_t GetByteSize(const std::vector<T>& parts);
-
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
diff --git a/library/cpp/yt/memory/weak_ptr.h b/library/cpp/yt/memory/weak_ptr.h
index d1647dc6e1..25a242bb8a 100644
--- a/library/cpp/yt/memory/weak_ptr.h
+++ b/library/cpp/yt/memory/weak_ptr.h
@@ -128,7 +128,7 @@ public:
}
//! Move assignment operator.
- TWeakPtr& operator=(TWeakPtr&& other) noexcept
+ TWeakPtr& operator=(TWeakPtr&& other) noexcept
{
other.Swap(*this);
return *this;
diff --git a/library/cpp/yt/misc/guid-inl.h b/library/cpp/yt/misc/guid-inl.h
index 5aa081592b..2d94b5701b 100644
--- a/library/cpp/yt/misc/guid-inl.h
+++ b/library/cpp/yt/misc/guid-inl.h
@@ -32,18 +32,18 @@ Y_FORCE_INLINE TGuid::operator bool() const
////////////////////////////////////////////////////////////////////////////////
-Y_FORCE_INLINE bool operator == (TGuid lhs, TGuid rhs)
+Y_FORCE_INLINE bool operator == (TGuid lhs, TGuid rhs)
{
return lhs.Parts64[0] == rhs.Parts64[0] &&
lhs.Parts64[1] == rhs.Parts64[1];
}
-Y_FORCE_INLINE bool operator != (TGuid lhs, TGuid rhs)
+Y_FORCE_INLINE bool operator != (TGuid lhs, TGuid rhs)
{
return !(lhs == rhs);
}
-Y_FORCE_INLINE bool operator < (TGuid lhs, TGuid rhs)
+Y_FORCE_INLINE bool operator < (TGuid lhs, TGuid rhs)
{
#ifdef __GNUC__
ui64 lhs0 = __builtin_bswap64(lhs.Parts64[0]);
diff --git a/library/cpp/yt/misc/guid.cpp b/library/cpp/yt/misc/guid.cpp
index 8f8817063e..882787d7a2 100644
--- a/library/cpp/yt/misc/guid.cpp
+++ b/library/cpp/yt/misc/guid.cpp
@@ -8,35 +8,35 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
-namespace {
-
-const ui8 HexDigits1[16] = {
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66
-};
-
-const ui16 HexDigits2[256] = {
- 0x3030, 0x3130, 0x3230, 0x3330, 0x3430, 0x3530, 0x3630, 0x3730, 0x3830, 0x3930, 0x6130, 0x6230, 0x6330, 0x6430, 0x6530, 0x6630,
- 0x3031, 0x3131, 0x3231, 0x3331, 0x3431, 0x3531, 0x3631, 0x3731, 0x3831, 0x3931, 0x6131, 0x6231, 0x6331, 0x6431, 0x6531, 0x6631,
- 0x3032, 0x3132, 0x3232, 0x3332, 0x3432, 0x3532, 0x3632, 0x3732, 0x3832, 0x3932, 0x6132, 0x6232, 0x6332, 0x6432, 0x6532, 0x6632,
- 0x3033, 0x3133, 0x3233, 0x3333, 0x3433, 0x3533, 0x3633, 0x3733, 0x3833, 0x3933, 0x6133, 0x6233, 0x6333, 0x6433, 0x6533, 0x6633,
- 0x3034, 0x3134, 0x3234, 0x3334, 0x3434, 0x3534, 0x3634, 0x3734, 0x3834, 0x3934, 0x6134, 0x6234, 0x6334, 0x6434, 0x6534, 0x6634,
- 0x3035, 0x3135, 0x3235, 0x3335, 0x3435, 0x3535, 0x3635, 0x3735, 0x3835, 0x3935, 0x6135, 0x6235, 0x6335, 0x6435, 0x6535, 0x6635,
- 0x3036, 0x3136, 0x3236, 0x3336, 0x3436, 0x3536, 0x3636, 0x3736, 0x3836, 0x3936, 0x6136, 0x6236, 0x6336, 0x6436, 0x6536, 0x6636,
- 0x3037, 0x3137, 0x3237, 0x3337, 0x3437, 0x3537, 0x3637, 0x3737, 0x3837, 0x3937, 0x6137, 0x6237, 0x6337, 0x6437, 0x6537, 0x6637,
- 0x3038, 0x3138, 0x3238, 0x3338, 0x3438, 0x3538, 0x3638, 0x3738, 0x3838, 0x3938, 0x6138, 0x6238, 0x6338, 0x6438, 0x6538, 0x6638,
- 0x3039, 0x3139, 0x3239, 0x3339, 0x3439, 0x3539, 0x3639, 0x3739, 0x3839, 0x3939, 0x6139, 0x6239, 0x6339, 0x6439, 0x6539, 0x6639,
- 0x3061, 0x3161, 0x3261, 0x3361, 0x3461, 0x3561, 0x3661, 0x3761, 0x3861, 0x3961, 0x6161, 0x6261, 0x6361, 0x6461, 0x6561, 0x6661,
- 0x3062, 0x3162, 0x3262, 0x3362, 0x3462, 0x3562, 0x3662, 0x3762, 0x3862, 0x3962, 0x6162, 0x6262, 0x6362, 0x6462, 0x6562, 0x6662,
- 0x3063, 0x3163, 0x3263, 0x3363, 0x3463, 0x3563, 0x3663, 0x3763, 0x3863, 0x3963, 0x6163, 0x6263, 0x6363, 0x6463, 0x6563, 0x6663,
- 0x3064, 0x3164, 0x3264, 0x3364, 0x3464, 0x3564, 0x3664, 0x3764, 0x3864, 0x3964, 0x6164, 0x6264, 0x6364, 0x6464, 0x6564, 0x6664,
- 0x3065, 0x3165, 0x3265, 0x3365, 0x3465, 0x3565, 0x3665, 0x3765, 0x3865, 0x3965, 0x6165, 0x6265, 0x6365, 0x6465, 0x6565, 0x6665,
- 0x3066, 0x3166, 0x3266, 0x3366, 0x3466, 0x3566, 0x3666, 0x3766, 0x3866, 0x3966, 0x6166, 0x6266, 0x6366, 0x6466, 0x6566, 0x6666
-};
-
-} // anonymous namespace
-
-////////////////////////////////////////////////////////////////////////////////
-
+namespace {
+
+const ui8 HexDigits1[16] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66
+};
+
+const ui16 HexDigits2[256] = {
+ 0x3030, 0x3130, 0x3230, 0x3330, 0x3430, 0x3530, 0x3630, 0x3730, 0x3830, 0x3930, 0x6130, 0x6230, 0x6330, 0x6430, 0x6530, 0x6630,
+ 0x3031, 0x3131, 0x3231, 0x3331, 0x3431, 0x3531, 0x3631, 0x3731, 0x3831, 0x3931, 0x6131, 0x6231, 0x6331, 0x6431, 0x6531, 0x6631,
+ 0x3032, 0x3132, 0x3232, 0x3332, 0x3432, 0x3532, 0x3632, 0x3732, 0x3832, 0x3932, 0x6132, 0x6232, 0x6332, 0x6432, 0x6532, 0x6632,
+ 0x3033, 0x3133, 0x3233, 0x3333, 0x3433, 0x3533, 0x3633, 0x3733, 0x3833, 0x3933, 0x6133, 0x6233, 0x6333, 0x6433, 0x6533, 0x6633,
+ 0x3034, 0x3134, 0x3234, 0x3334, 0x3434, 0x3534, 0x3634, 0x3734, 0x3834, 0x3934, 0x6134, 0x6234, 0x6334, 0x6434, 0x6534, 0x6634,
+ 0x3035, 0x3135, 0x3235, 0x3335, 0x3435, 0x3535, 0x3635, 0x3735, 0x3835, 0x3935, 0x6135, 0x6235, 0x6335, 0x6435, 0x6535, 0x6635,
+ 0x3036, 0x3136, 0x3236, 0x3336, 0x3436, 0x3536, 0x3636, 0x3736, 0x3836, 0x3936, 0x6136, 0x6236, 0x6336, 0x6436, 0x6536, 0x6636,
+ 0x3037, 0x3137, 0x3237, 0x3337, 0x3437, 0x3537, 0x3637, 0x3737, 0x3837, 0x3937, 0x6137, 0x6237, 0x6337, 0x6437, 0x6537, 0x6637,
+ 0x3038, 0x3138, 0x3238, 0x3338, 0x3438, 0x3538, 0x3638, 0x3738, 0x3838, 0x3938, 0x6138, 0x6238, 0x6338, 0x6438, 0x6538, 0x6638,
+ 0x3039, 0x3139, 0x3239, 0x3339, 0x3439, 0x3539, 0x3639, 0x3739, 0x3839, 0x3939, 0x6139, 0x6239, 0x6339, 0x6439, 0x6539, 0x6639,
+ 0x3061, 0x3161, 0x3261, 0x3361, 0x3461, 0x3561, 0x3661, 0x3761, 0x3861, 0x3961, 0x6161, 0x6261, 0x6361, 0x6461, 0x6561, 0x6661,
+ 0x3062, 0x3162, 0x3262, 0x3362, 0x3462, 0x3562, 0x3662, 0x3762, 0x3862, 0x3962, 0x6162, 0x6262, 0x6362, 0x6462, 0x6562, 0x6662,
+ 0x3063, 0x3163, 0x3263, 0x3363, 0x3463, 0x3563, 0x3663, 0x3763, 0x3863, 0x3963, 0x6163, 0x6263, 0x6363, 0x6463, 0x6563, 0x6663,
+ 0x3064, 0x3164, 0x3264, 0x3364, 0x3464, 0x3564, 0x3664, 0x3764, 0x3864, 0x3964, 0x6164, 0x6264, 0x6364, 0x6464, 0x6564, 0x6664,
+ 0x3065, 0x3165, 0x3265, 0x3365, 0x3465, 0x3565, 0x3665, 0x3765, 0x3865, 0x3965, 0x6165, 0x6265, 0x6365, 0x6465, 0x6565, 0x6665,
+ 0x3066, 0x3166, 0x3266, 0x3366, 0x3466, 0x3566, 0x3666, 0x3766, 0x3866, 0x3966, 0x6166, 0x6266, 0x6366, 0x6466, 0x6566, 0x6666
+};
+
+} // anonymous namespace
+
+////////////////////////////////////////////////////////////////////////////////
+
TGuid TGuid::Create()
{
return TGuid(RandomNumber<ui64>(), RandomNumber<ui64>());
@@ -54,48 +54,48 @@ TGuid TGuid::FromString(TStringBuf str)
bool TGuid::FromString(TStringBuf str, TGuid* result)
{
- size_t partId = 3;
- ui64 partValue = 0;
- bool isEmptyPart = true;
-
- for (size_t i = 0; i != str.size(); ++i) {
- const char c = str[i];
-
- if (c == '-') {
- if (isEmptyPart || partId == 0) { // x-y--z, -x-y-z or x-y-z-m-...
- return false;
- }
- result->Parts32[partId] = static_cast<ui32>(partValue);
- --partId;
- partValue = 0;
- isEmptyPart = true;
- continue;
- }
-
- ui32 digit = 0;
- if ('0' <= c && c <= '9') {
- digit = c - '0';
- } else if ('a' <= c && c <= 'f') {
- digit = c - 'a' + 10;
- } else if ('A' <= c && c <= 'F') {
- digit = c - 'A' + 10;
- } else {
- return false; // non-hex character
- }
-
- partValue = partValue * 16 + digit;
- isEmptyPart = false;
-
- // overflow check
- if (partValue > Max<ui32>()) {
- return false;
- }
- }
-
- if (partId != 0 || isEmptyPart) { // x-y or x-y-z-
+ size_t partId = 3;
+ ui64 partValue = 0;
+ bool isEmptyPart = true;
+
+ for (size_t i = 0; i != str.size(); ++i) {
+ const char c = str[i];
+
+ if (c == '-') {
+ if (isEmptyPart || partId == 0) { // x-y--z, -x-y-z or x-y-z-m-...
+ return false;
+ }
+ result->Parts32[partId] = static_cast<ui32>(partValue);
+ --partId;
+ partValue = 0;
+ isEmptyPart = true;
+ continue;
+ }
+
+ ui32 digit = 0;
+ if ('0' <= c && c <= '9') {
+ digit = c - '0';
+ } else if ('a' <= c && c <= 'f') {
+ digit = c - 'a' + 10;
+ } else if ('A' <= c && c <= 'F') {
+ digit = c - 'A' + 10;
+ } else {
+ return false; // non-hex character
+ }
+
+ partValue = partValue * 16 + digit;
+ isEmptyPart = false;
+
+ // overflow check
+ if (partValue > Max<ui32>()) {
+ return false;
+ }
+ }
+
+ if (partId != 0 || isEmptyPart) { // x-y or x-y-z-
return false;
}
- result->Parts32[partId] = static_cast<ui32>(partValue);
+ result->Parts32[partId] = static_cast<ui32>(partValue);
return true;
}
@@ -139,65 +139,65 @@ bool TGuid::FromStringHex32(TStringBuf str, TGuid* result)
return ok;
}
-char* WriteGuidToBuffer(char* ptr, TGuid value)
-{
- auto writeHex1 = [&] (ui8 x) {
- *ptr = HexDigits1[x];
- ptr += 1;
- };
-
- auto writeHex2 = [&] (ui8 x) {
- ::memcpy(ptr, &HexDigits2[x], 2);
- ptr += 2;
- };
-
- auto writeComponent = [&] (ui32 x) {
- /* */ if (x >= 0x10000000) {
- writeHex2((x >> 24) & 0xff);
- writeHex2((x >> 16) & 0xff);
- writeHex2((x >> 8) & 0xff);
- writeHex2( x & 0xff);
- } else if (x >= 0x1000000) {
- writeHex1( x >> 24);
- writeHex2((x >> 16) & 0xff);
- writeHex2((x >> 8) & 0xff);
- writeHex2( x & 0xff);
- } else if (x >= 0x100000) {
- writeHex2((x >> 16) & 0xff);
- writeHex2((x >> 8) & 0xff);
- writeHex2( x & 0xff);
- } else if (x >= 0x10000) {
- writeHex1( x >> 16);
- writeHex2((x >> 8) & 0xff);
- writeHex2( x & 0xff);
- } else if (x >= 0x1000) {
- writeHex2( x >> 8);
- writeHex2( x & 0xff);
- } else if (x >= 0x100) {
- writeHex1( x >> 8);
- writeHex2( x & 0xff);
- } else if (x >= 0x10) {
- writeHex2( x);
- } else {
- writeHex1( x);
- }
- };
-
- auto writeDash = [&] () {
- *ptr++ = '-';
- };
-
- writeComponent(value.Parts32[3]);
- writeDash();
- writeComponent(value.Parts32[2]);
- writeDash();
- writeComponent(value.Parts32[1]);
- writeDash();
- writeComponent(value.Parts32[0]);
-
- return ptr;
-}
-
+char* WriteGuidToBuffer(char* ptr, TGuid value)
+{
+ auto writeHex1 = [&] (ui8 x) {
+ *ptr = HexDigits1[x];
+ ptr += 1;
+ };
+
+ auto writeHex2 = [&] (ui8 x) {
+ ::memcpy(ptr, &HexDigits2[x], 2);
+ ptr += 2;
+ };
+
+ auto writeComponent = [&] (ui32 x) {
+ /* */ if (x >= 0x10000000) {
+ writeHex2((x >> 24) & 0xff);
+ writeHex2((x >> 16) & 0xff);
+ writeHex2((x >> 8) & 0xff);
+ writeHex2( x & 0xff);
+ } else if (x >= 0x1000000) {
+ writeHex1( x >> 24);
+ writeHex2((x >> 16) & 0xff);
+ writeHex2((x >> 8) & 0xff);
+ writeHex2( x & 0xff);
+ } else if (x >= 0x100000) {
+ writeHex2((x >> 16) & 0xff);
+ writeHex2((x >> 8) & 0xff);
+ writeHex2( x & 0xff);
+ } else if (x >= 0x10000) {
+ writeHex1( x >> 16);
+ writeHex2((x >> 8) & 0xff);
+ writeHex2( x & 0xff);
+ } else if (x >= 0x1000) {
+ writeHex2( x >> 8);
+ writeHex2( x & 0xff);
+ } else if (x >= 0x100) {
+ writeHex1( x >> 8);
+ writeHex2( x & 0xff);
+ } else if (x >= 0x10) {
+ writeHex2( x);
+ } else {
+ writeHex1( x);
+ }
+ };
+
+ auto writeDash = [&] () {
+ *ptr++ = '-';
+ };
+
+ writeComponent(value.Parts32[3]);
+ writeDash();
+ writeComponent(value.Parts32[2]);
+ writeDash();
+ writeComponent(value.Parts32[1]);
+ writeDash();
+ writeComponent(value.Parts32[0]);
+
+ return ptr;
+}
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
diff --git a/library/cpp/yt/misc/guid.h b/library/cpp/yt/misc/guid.h
index 9142fddd9d..ec4ba3526a 100644
--- a/library/cpp/yt/misc/guid.h
+++ b/library/cpp/yt/misc/guid.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/typetraits.h>
#include <library/cpp/yt/exception/exception.h>
@@ -78,17 +78,17 @@ struct TGuid
static bool FromStringHex32(TStringBuf str, TGuid* guid);
};
-bool operator == (TGuid lhs, TGuid rhs);
-bool operator != (TGuid lhs, TGuid rhs);
-bool operator < (TGuid lhs, TGuid rhs);
+bool operator == (TGuid lhs, TGuid rhs);
+bool operator != (TGuid lhs, TGuid rhs);
+bool operator < (TGuid lhs, TGuid rhs);
////////////////////////////////////////////////////////////////////////////////
constexpr int MaxGuidStringSize = 4 * 8 + 3;
-char* WriteGuidToBuffer(char* ptr, TGuid value);
-
-////////////////////////////////////////////////////////////////////////////////
-
+char* WriteGuidToBuffer(char* ptr, TGuid value);
+
+////////////////////////////////////////////////////////////////////////////////
+
} // namespace NYT
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/misc/hash.h b/library/cpp/yt/misc/hash.h
index d44ddc9cad..2fecf89506 100644
--- a/library/cpp/yt/misc/hash.h
+++ b/library/cpp/yt/misc/hash.h
@@ -2,8 +2,8 @@
#include <util/generic/hash.h>
-#include <util/random/random.h>
-
+#include <util/random/random.h>
+
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
@@ -18,25 +18,25 @@ template <class T>
void HashCombine(size_t& h, const T& k);
////////////////////////////////////////////////////////////////////////////////
-
-//! Provides a hasher that randomizes the results of another one.
-template <class TElement, class TUnderlying = ::THash<TElement>>
-class TRandomizedHash
-{
-public:
+
+//! Provides a hasher that randomizes the results of another one.
+template <class TElement, class TUnderlying = ::THash<TElement>>
+class TRandomizedHash
+{
+public:
TRandomizedHash();
size_t operator () (const TElement& element) const;
-
-private:
- size_t Seed_;
- TUnderlying Underlying_;
-
-};
-
+
+private:
+ size_t Seed_;
+ TUnderlying Underlying_;
+
+};
+
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYT
-
+} // namespace NYT
+
#define HASH_INL_H_
#include "hash-inl.h"
#undef HASH_INL_H_
diff --git a/library/cpp/yt/misc/unittests/enum_ut.cpp b/library/cpp/yt/misc/unittests/enum_ut.cpp
index 2d036bf3e1..6af11b04dc 100644
--- a/library/cpp/yt/misc/unittests/enum_ut.cpp
+++ b/library/cpp/yt/misc/unittests/enum_ut.cpp
@@ -1,6 +1,6 @@
-#include <library/cpp/testing/gtest/gtest.h>
+#include <library/cpp/testing/gtest/gtest.h>
-#include <library/cpp/yt/misc/enum.h>
+#include <library/cpp/yt/misc/enum.h>
namespace NYT {
namespace {
diff --git a/library/cpp/yt/misc/unittests/guid_ut.cpp b/library/cpp/yt/misc/unittests/guid_ut.cpp
index 694bf273b4..ce9ee52109 100644
--- a/library/cpp/yt/misc/unittests/guid_ut.cpp
+++ b/library/cpp/yt/misc/unittests/guid_ut.cpp
@@ -1,6 +1,6 @@
-#include <library/cpp/testing/gtest/gtest.h>
+#include <library/cpp/testing/gtest/gtest.h>
-#include <library/cpp/yt/misc/guid.h>
+#include <library/cpp/yt/misc/guid.h>
namespace NYT {
namespace {
diff --git a/library/cpp/yt/misc/unittests/ya.make b/library/cpp/yt/misc/unittests/ya.make
index 88a607656d..690082ca59 100644
--- a/library/cpp/yt/misc/unittests/ya.make
+++ b/library/cpp/yt/misc/unittests/ya.make
@@ -3,8 +3,8 @@ GTEST(unittester-library-misc)
OWNER(g:yt)
SRCS(
- enum_ut.cpp
- guid_ut.cpp
+ enum_ut.cpp
+ guid_ut.cpp
preprocessor_ut.cpp
)
diff --git a/library/cpp/yt/misc/ya.make b/library/cpp/yt/misc/ya.make
index 74999c61d5..bb76711ddd 100644
--- a/library/cpp/yt/misc/ya.make
+++ b/library/cpp/yt/misc/ya.make
@@ -3,7 +3,7 @@ LIBRARY()
OWNER(g:yt)
SRCS(
- guid.cpp
+ guid.cpp
source_location.cpp
)
diff --git a/library/cpp/yt/small_containers/compact_set-inl.h b/library/cpp/yt/small_containers/compact_set-inl.h
index eee22b2029..75b8600175 100644
--- a/library/cpp/yt/small_containers/compact_set-inl.h
+++ b/library/cpp/yt/small_containers/compact_set-inl.h
@@ -35,7 +35,7 @@ private:
template <class TOther>
void ConstructFrom(TOther&& rhs)
{
- Y_VERIFY_DEBUG(Small == rhs.Small);
+ Y_VERIFY_DEBUG(Small == rhs.Small);
if (Small) {
new (&VIter)TVectorConstIterator(std::forward<TOther>(rhs).VIter);
@@ -251,7 +251,7 @@ std::pair<typename TCompactSet<T, N, C>::const_iterator, bool> TCompactSet<T, N,
Vector.clear();
auto [newIt, inserted] = Set.insert(v);
- Y_VERIFY_DEBUG(inserted);
+ Y_VERIFY_DEBUG(inserted);
return {const_iterator(std::move(newIt)), true};
}
diff --git a/library/cpp/yt/small_containers/compact_set.h b/library/cpp/yt/small_containers/compact_set.h
index 3988311558..2ca8713ea7 100644
--- a/library/cpp/yt/small_containers/compact_set.h
+++ b/library/cpp/yt/small_containers/compact_set.h
@@ -15,8 +15,8 @@
#include "compact_vector.h"
-#include <util/system/yassert.h>
-
+#include <util/system/yassert.h>
+
#include <cstddef>
#include <iterator>
#include <set>
diff --git a/library/cpp/yt/small_containers/unittests/compact_set_ut.cpp b/library/cpp/yt/small_containers/unittests/compact_set_ut.cpp
index 4140f882e5..ebab5846e1 100644
--- a/library/cpp/yt/small_containers/unittests/compact_set_ut.cpp
+++ b/library/cpp/yt/small_containers/unittests/compact_set_ut.cpp
@@ -12,8 +12,8 @@
#include <library/cpp/yt/small_containers/compact_set.h>
-#include <library/cpp/testing/gtest/gtest.h>
-
+#include <library/cpp/testing/gtest/gtest.h>
+
#include <string>
namespace NYT {
diff --git a/library/cpp/yt/small_containers/unittests/ya.make b/library/cpp/yt/small_containers/unittests/ya.make
index 9a9ec4d542..6bd8e1d0ec 100644
--- a/library/cpp/yt/small_containers/unittests/ya.make
+++ b/library/cpp/yt/small_containers/unittests/ya.make
@@ -1,17 +1,17 @@
-GTEST(unittester-small-containers)
-
-OWNER(g:yt)
-
-SRCS(
+GTEST(unittester-small-containers)
+
+OWNER(g:yt)
+
+SRCS(
compact_flat_map_ut.cpp
compact_heap_ut.cpp
compact_set_ut.cpp
compact_vector_ut.cpp
-)
-
-PEERDIR(
+)
+
+PEERDIR(
library/cpp/yt/small_containers
- library/cpp/testing/gtest
-)
-
-END()
+ library/cpp/testing/gtest
+)
+
+END()
diff --git a/library/cpp/yt/small_containers/ya.make b/library/cpp/yt/small_containers/ya.make
index 9e65d64c71..d886b2ddac 100644
--- a/library/cpp/yt/small_containers/ya.make
+++ b/library/cpp/yt/small_containers/ya.make
@@ -1,20 +1,20 @@
-LIBRARY()
-
-PEERDIR(
+LIBRARY()
+
+PEERDIR(
library/cpp/yt/assert
library/cpp/yt/malloc
-)
-
-CHECK_DEPENDENT_DIRS(
- ALLOW_ONLY ALL
- build
- contrib
- library
- util
-)
-
-END()
-
-RECURSE_FOR_TESTS(
- unittests
-)
+)
+
+CHECK_DEPENDENT_DIRS(
+ ALLOW_ONLY ALL
+ build
+ contrib
+ library
+ util
+)
+
+END()
+
+RECURSE_FOR_TESTS(
+ unittests
+)
diff --git a/library/cpp/yt/string/enum.cpp b/library/cpp/yt/string/enum.cpp
index 145f0f1185..7cb8e5c6b6 100644
--- a/library/cpp/yt/string/enum.cpp
+++ b/library/cpp/yt/string/enum.cpp
@@ -1,6 +1,6 @@
-#include "enum.h"
+#include "enum.h"
-#include "format.h"
+#include "format.h"
namespace NYT {
@@ -9,12 +9,12 @@ namespace NYT {
TString DecodeEnumValue(TStringBuf value)
{
auto camelValue = UnderscoreCaseToCamelCase(value);
- auto underscoreValue = CamelCaseToUnderscoreCase(camelValue);
- if (value != underscoreValue) {
+ auto underscoreValue = CamelCaseToUnderscoreCase(camelValue);
+ if (value != underscoreValue) {
throw TSimpleException(Format("Enum value %Qv is not in a proper underscore case; did you mean %Qv?",
- value,
+ value,
underscoreValue));
- }
+ }
return camelValue;
}
diff --git a/library/cpp/yt/string/enum.h b/library/cpp/yt/string/enum.h
index 3f376603d5..10dc02610f 100644
--- a/library/cpp/yt/string/enum.h
+++ b/library/cpp/yt/string/enum.h
@@ -1,10 +1,10 @@
#pragma once
-#include "string.h"
+#include "string.h"
-#include <library/cpp/yt/misc/enum.h>
+#include <library/cpp/yt/misc/enum.h>
-#include <optional>
+#include <optional>
namespace NYT {
diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h
index fa48e442de..5484d4a216 100644
--- a/library/cpp/yt/string/format-inl.h
+++ b/library/cpp/yt/string/format-inl.h
@@ -8,13 +8,13 @@
#include "string.h"
#include <library/cpp/yt/assert/assert.h>
-
+
#include <library/cpp/yt/small_containers/compact_vector.h>
-
+
#include <library/cpp/yt/misc/enum.h>
-
+
#include <cctype>
-#include <optional>
+#include <optional>
namespace NYT {
@@ -22,11 +22,11 @@ namespace NYT {
static const char GenericSpecSymbol = 'v';
-inline bool IsQuotationSpecSymbol(char symbol)
-{
- return symbol == 'Q' || symbol == 'q';
-}
-
+inline bool IsQuotationSpecSymbol(char symbol)
+{
+ return symbol == 'Q' || symbol == 'q';
+}
+
// TStringBuf
inline void FormatValue(TStringBuilderBase* builder, TStringBuf value, TStringBuf format)
{
@@ -137,7 +137,7 @@ inline void FormatValue(TStringBuilderBase* builder, bool value, TStringBuf form
if (*current == 'l') {
++current;
lowercase = true;
- } else if (IsQuotationSpecSymbol(*current)) {
+ } else if (IsQuotationSpecSymbol(*current)) {
++current;
} else
break;
@@ -178,7 +178,7 @@ struct TValueFormatter<TEnum, typename std::enable_if<TEnumTraits<TEnum>::IsEnum
if (*current == 'l') {
++current;
lowercase = true;
- } else if (IsQuotationSpecSymbol(*current)) {
+ } else if (IsQuotationSpecSymbol(*current)) {
++current;
} else {
break;
@@ -237,27 +237,27 @@ void FormatRange(TStringBuilderBase* builder, const TRange& range, const TFormat
builder->AppendChar(']');
}
-template <class TRange, class TFormatter>
+template <class TRange, class TFormatter>
void FormatKeyValueRange(TStringBuilderBase* builder, const TRange& range, const TFormatter& formatter, size_t limit = std::numeric_limits<size_t>::max())
-{
- builder->AppendChar('{');
+{
+ builder->AppendChar('{');
size_t index = 0;
- for (const auto& item : range) {
+ for (const auto& item : range) {
if (index > 0) {
- builder->AppendString(DefaultJoinToStringDelimiter);
- }
+ builder->AppendString(DefaultJoinToStringDelimiter);
+ }
if (index == limit) {
- builder->AppendString(DefaultRangeEllipsisFormat);
- break;
- }
- formatter(builder, item.first);
- builder->AppendString(DefaultKeyValueDelimiter);
- formatter(builder, item.second);
+ builder->AppendString(DefaultRangeEllipsisFormat);
+ break;
+ }
+ formatter(builder, item.first);
+ builder->AppendString(DefaultKeyValueDelimiter);
+ formatter(builder, item.second);
++index;
- }
- builder->AppendChar('}');
-}
-
+ }
+ builder->AppendChar('}');
+}
+
// TFormattableView
template <class TRange, class TFormatter>
struct TValueFormatter<TFormattableView<TRange, TFormatter>>
@@ -317,26 +317,26 @@ struct TValueFormatter<std::set<T>>
}
};
-// std::map
-template <class K, class V>
-struct TValueFormatter<std::map<K, V>>
-{
+// std::map
+template <class K, class V>
+struct TValueFormatter<std::map<K, V>>
+{
static void Do(TStringBuilderBase* builder, const std::map<K, V>& collection, TStringBuf /*format*/)
- {
- FormatKeyValueRange(builder, collection, TDefaultFormatter());
- }
-};
-
-// std::multimap
-template <class K, class V>
-struct TValueFormatter<std::multimap<K, V>>
-{
+ {
+ FormatKeyValueRange(builder, collection, TDefaultFormatter());
+ }
+};
+
+// std::multimap
+template <class K, class V>
+struct TValueFormatter<std::multimap<K, V>>
+{
static void Do(TStringBuilderBase* builder, const std::multimap<K, V>& collection, TStringBuf /*format*/)
- {
- FormatKeyValueRange(builder, collection, TDefaultFormatter());
- }
-};
-
+ {
+ FormatKeyValueRange(builder, collection, TDefaultFormatter());
+ }
+};
+
// THashSet
template <class T>
struct TValueFormatter<THashSet<T>>
@@ -357,26 +357,26 @@ struct TValueFormatter<THashMultiSet<T>>
}
};
-// THashMap
-template <class K, class V>
-struct TValueFormatter<THashMap<K, V>>
-{
+// THashMap
+template <class K, class V>
+struct TValueFormatter<THashMap<K, V>>
+{
static void Do(TStringBuilderBase* builder, const THashMap<K, V>& collection, TStringBuf /*format*/)
- {
- FormatKeyValueRange(builder, collection, TDefaultFormatter());
- }
-};
-
-// THashMultiMap
-template <class K, class V>
-struct TValueFormatter<THashMultiMap<K, V>>
-{
+ {
+ FormatKeyValueRange(builder, collection, TDefaultFormatter());
+ }
+};
+
+// THashMultiMap
+template <class K, class V>
+struct TValueFormatter<THashMultiMap<K, V>>
+{
static void Do(TStringBuilderBase* builder, const THashMultiMap<K, V>& collection, TStringBuf /*format*/)
- {
- FormatKeyValueRange(builder, collection, TDefaultFormatter());
- }
-};
-
+ {
+ FormatKeyValueRange(builder, collection, TDefaultFormatter());
+ }
+};
+
// TEnumIndexedVector
template <class E, class T>
struct TValueFormatter<TEnumIndexedVector<E, T>>
@@ -439,37 +439,37 @@ auto FormatValue(TStringBuilderBase* builder, const TValue& value, TStringBuf fo
}
template <class TValue>
-void FormatValueViaSprintf(
+void FormatValueViaSprintf(
TStringBuilderBase* builder,
- TValue value,
+ TValue value,
TStringBuf format,
TStringBuf genericSpec)
{
constexpr int MaxFormatSize = 64;
constexpr int SmallResultSize = 64;
- auto copyFormat = [] (char* destination, const char* source, int length) {
- int position = 0;
+ auto copyFormat = [] (char* destination, const char* source, int length) {
+ int position = 0;
for (int index = 0; index < length; ++index) {
- if (IsQuotationSpecSymbol(source[index])) {
- continue;
- }
- destination[position] = source[index];
- ++position;
- }
- return destination + position;
- };
-
+ if (IsQuotationSpecSymbol(source[index])) {
+ continue;
+ }
+ destination[position] = source[index];
+ ++position;
+ }
+ return destination + position;
+ };
+
char formatBuf[MaxFormatSize];
YT_VERIFY(format.length() >= 1 && format.length() <= MaxFormatSize - 2); // one for %, one for \0
formatBuf[0] = '%';
if (format[format.length() - 1] == GenericSpecSymbol) {
- char* formatEnd = copyFormat(formatBuf + 1, format.begin(), format.length() - 1);
+ char* formatEnd = copyFormat(formatBuf + 1, format.begin(), format.length() - 1);
::memcpy(formatEnd, genericSpec.begin(), genericSpec.length());
- formatEnd[genericSpec.length()] = '\0';
+ formatEnd[genericSpec.length()] = '\0';
} else {
- char* formatEnd = copyFormat(formatBuf + 1, format.begin(), format.length());
- *formatEnd = '\0';
+ char* formatEnd = copyFormat(formatBuf + 1, format.begin(), format.length());
+ *formatEnd = '\0';
}
char* result = builder->Preallocate(SmallResultSize);
@@ -481,27 +481,27 @@ void FormatValueViaSprintf(
builder->Advance(resultSize);
}
-template <class TValue>
-char* WriteIntToBufferBackwards(char* buffer, TValue value);
-
-template <class TValue>
+template <class TValue>
+char* WriteIntToBufferBackwards(char* buffer, TValue value);
+
+template <class TValue>
void FormatValueViaHelper(TStringBuilderBase* builder, TValue value, TStringBuf format, TStringBuf genericSpec)
-{
+{
if (format == TStringBuf("v")) {
- const int MaxResultSize = 64;
- char buffer[MaxResultSize];
- char* end = buffer + MaxResultSize;
- char* start = WriteIntToBufferBackwards(end, value);
- builder->AppendString(TStringBuf(start, end));
- } else {
- FormatValueViaSprintf(builder, value, format, genericSpec);
- }
-}
-
-#define XX(valueType, castType, genericSpec) \
+ const int MaxResultSize = 64;
+ char buffer[MaxResultSize];
+ char* end = buffer + MaxResultSize;
+ char* start = WriteIntToBufferBackwards(end, value);
+ builder->AppendString(TStringBuf(start, end));
+ } else {
+ FormatValueViaSprintf(builder, value, format, genericSpec);
+ }
+}
+
+#define XX(valueType, castType, genericSpec) \
inline void FormatValue(TStringBuilderBase* builder, valueType value, TStringBuf format) \
{ \
- FormatValueViaHelper(builder, static_cast<castType>(value), format, genericSpec); \
+ FormatValueViaHelper(builder, static_cast<castType>(value), format, genericSpec); \
}
XX(i8, int, TStringBuf("d"))
@@ -513,32 +513,32 @@ XX(ui32, unsigned int, TStringBuf("u"))
XX(long, long, TStringBuf("ld"))
XX(unsigned long, unsigned long, TStringBuf("lu"))
-#undef XX
+#undef XX
-#define XX(valueType, castType, genericSpec) \
+#define XX(valueType, castType, genericSpec) \
inline void FormatValue(TStringBuilderBase* builder, valueType value, TStringBuf format) \
- { \
- FormatValueViaSprintf(builder, static_cast<castType>(value), format, genericSpec); \
- }
-
+ { \
+ FormatValueViaSprintf(builder, static_cast<castType>(value), format, genericSpec); \
+ }
+
XX(double, double, TStringBuf("lf"))
XX(float, float, TStringBuf("f"))
-
-#undef XX
-
+
+#undef XX
+
// Pointer
-template <class T>
+template <class T>
void FormatValue(TStringBuilderBase* builder, T* value, TStringBuf format)
-{
+{
FormatValueViaSprintf(builder, value, format, TStringBuf("p"));
-}
-
-// TDuration (specialize for performance reasons)
+}
+
+// TDuration (specialize for performance reasons)
inline void FormatValue(TStringBuilderBase* builder, TDuration value, TStringBuf /*format*/)
-{
+{
builder->AppendFormat("%vus", value.MicroSeconds());
-}
-
+}
+
// TInstant (specialize for TFormatTraits)
inline void FormatValue(TStringBuilderBase* builder, TInstant value, TStringBuf format)
{
diff --git a/library/cpp/yt/string/guid.cpp b/library/cpp/yt/string/guid.cpp
index 7db913fede..6c133a9778 100644
--- a/library/cpp/yt/string/guid.cpp
+++ b/library/cpp/yt/string/guid.cpp
@@ -1,22 +1,22 @@
-#include "guid.h"
-
-namespace NYT {
-
-////////////////////////////////////////////////////////////////////////////////
-
-void FormatValue(TStringBuilderBase* builder, TGuid value, TStringBuf /*format*/)
-{
+#include "guid.h"
+
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
+void FormatValue(TStringBuilderBase* builder, TGuid value, TStringBuf /*format*/)
+{
char* begin = builder->Preallocate(MaxGuidStringSize);
- char* end = WriteGuidToBuffer(begin, value);
- builder->Advance(end - begin);
-}
-
-TString ToString(TGuid guid)
-{
- return ToStringViaBuilder(guid);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace NYT
-
+ char* end = WriteGuidToBuffer(begin, value);
+ builder->Advance(end - begin);
+}
+
+TString ToString(TGuid guid)
+{
+ return ToStringViaBuilder(guid);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT
+
diff --git a/library/cpp/yt/string/guid.h b/library/cpp/yt/string/guid.h
index e46b3a5db0..75edbce5db 100644
--- a/library/cpp/yt/string/guid.h
+++ b/library/cpp/yt/string/guid.h
@@ -1,14 +1,14 @@
-#include <library/cpp/yt/misc/guid.h>
-
-#include "format.h"
-
-namespace NYT {
-
-////////////////////////////////////////////////////////////////////////////////
-
-void FormatValue(TStringBuilderBase* builder, TGuid value, TStringBuf /*format*/);
-TString ToString(TGuid guid);
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace NYT
+#include <library/cpp/yt/misc/guid.h>
+
+#include "format.h"
+
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
+void FormatValue(TStringBuilderBase* builder, TGuid value, TStringBuf /*format*/);
+TString ToString(TGuid guid);
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT
diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp
index 24ea4a6ba3..7440ac3fdd 100644
--- a/library/cpp/yt/string/string.cpp
+++ b/library/cpp/yt/string/string.cpp
@@ -2,9 +2,9 @@
#include "format.h"
#include <library/cpp/yt/assert/assert.h>
-
+
#include <util/generic/hash.h>
-
+
#include <util/string/ascii.h>
namespace NYT {
@@ -103,117 +103,117 @@ TString Trim(const TString& str, const TString& whitespaces)
////////////////////////////////////////////////////////////////////////////////
-namespace {
-
-ui16 DecimalDigits2[100] = {
- 12336, 12592, 12848, 13104, 13360, 13616, 13872, 14128, 14384, 14640,
- 12337, 12593, 12849, 13105, 13361, 13617, 13873, 14129, 14385, 14641,
- 12338, 12594, 12850, 13106, 13362, 13618, 13874, 14130, 14386, 14642,
- 12339, 12595, 12851, 13107, 13363, 13619, 13875, 14131, 14387, 14643,
- 12340, 12596, 12852, 13108, 13364, 13620, 13876, 14132, 14388, 14644,
- 12341, 12597, 12853, 13109, 13365, 13621, 13877, 14133, 14389, 14645,
- 12342, 12598, 12854, 13110, 13366, 13622, 13878, 14134, 14390, 14646,
- 12343, 12599, 12855, 13111, 13367, 13623, 13879, 14135, 14391, 14647,
- 12344, 12600, 12856, 13112, 13368, 13624, 13880, 14136, 14392, 14648,
- 12345, 12601, 12857, 13113, 13369, 13625, 13881, 14137, 14393, 14649
-};
-
-template <class T>
+namespace {
+
+ui16 DecimalDigits2[100] = {
+ 12336, 12592, 12848, 13104, 13360, 13616, 13872, 14128, 14384, 14640,
+ 12337, 12593, 12849, 13105, 13361, 13617, 13873, 14129, 14385, 14641,
+ 12338, 12594, 12850, 13106, 13362, 13618, 13874, 14130, 14386, 14642,
+ 12339, 12595, 12851, 13107, 13363, 13619, 13875, 14131, 14387, 14643,
+ 12340, 12596, 12852, 13108, 13364, 13620, 13876, 14132, 14388, 14644,
+ 12341, 12597, 12853, 13109, 13365, 13621, 13877, 14133, 14389, 14645,
+ 12342, 12598, 12854, 13110, 13366, 13622, 13878, 14134, 14390, 14646,
+ 12343, 12599, 12855, 13111, 13367, 13623, 13879, 14135, 14391, 14647,
+ 12344, 12600, 12856, 13112, 13368, 13624, 13880, 14136, 14392, 14648,
+ 12345, 12601, 12857, 13113, 13369, 13625, 13881, 14137, 14393, 14649
+};
+
+template <class T>
char* WriteSignedIntToBufferBackwardsImpl(char* ptr, T value, TStringBuf min)
-{
- if (value == 0) {
- --ptr;
- *ptr = '0';
- return ptr;
- }
-
- // The negative value handling code below works incorrectly for min values.
- if (value == std::numeric_limits<T>::min()) {
- ptr -= min.length();
+{
+ if (value == 0) {
+ --ptr;
+ *ptr = '0';
+ return ptr;
+ }
+
+ // 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());
- return ptr;
- }
-
- bool negative = false;
- if (value < 0) {
- negative = true;
- value = -value;
- }
-
- while (value >= 10) {
- i64 rem = value % 100;
- i64 quot = value / 100;
- ptr -= 2;
+ return ptr;
+ }
+
+ bool negative = false;
+ if (value < 0) {
+ negative = true;
+ value = -value;
+ }
+
+ while (value >= 10) {
+ i64 rem = value % 100;
+ i64 quot = value / 100;
+ ptr -= 2;
::memcpy(ptr, &DecimalDigits2[rem], 2);
- value = quot;
- }
-
- if (value > 0) {
- --ptr;
- *ptr = ('0' + value);
- }
-
- if (negative) {
- --ptr;
- *ptr = '-';
- }
-
- return ptr;
-}
-
-template <class T>
-char* WriteUnsignedIntToBufferBackwardsImpl(char* ptr, T value)
-{
- if (value == 0) {
- --ptr;
- *ptr = '0';
- return ptr;
- }
-
- while (value >= 10) {
- i64 rem = value % 100;
- i64 quot = value / 100;
- ptr -= 2;
+ value = quot;
+ }
+
+ if (value > 0) {
+ --ptr;
+ *ptr = ('0' + value);
+ }
+
+ if (negative) {
+ --ptr;
+ *ptr = '-';
+ }
+
+ return ptr;
+}
+
+template <class T>
+char* WriteUnsignedIntToBufferBackwardsImpl(char* ptr, T value)
+{
+ if (value == 0) {
+ --ptr;
+ *ptr = '0';
+ return ptr;
+ }
+
+ while (value >= 10) {
+ i64 rem = value % 100;
+ i64 quot = value / 100;
+ ptr -= 2;
::memcpy(ptr, &DecimalDigits2[rem], 2);
- value = quot;
- }
-
- if (value > 0) {
- --ptr;
- *ptr = ('0' + value);
- }
-
- return ptr;
-}
-
-} // namespace
-
-template <>
-char* WriteIntToBufferBackwards(char* ptr, i32 value)
-{
+ value = quot;
+ }
+
+ if (value > 0) {
+ --ptr;
+ *ptr = ('0' + value);
+ }
+
+ return ptr;
+}
+
+} // namespace
+
+template <>
+char* WriteIntToBufferBackwards(char* ptr, i32 value)
+{
return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-2147483647"));
-}
-
-template <>
-char* WriteIntToBufferBackwards(char* ptr, i64 value)
-{
+}
+
+template <>
+char* WriteIntToBufferBackwards(char* ptr, i64 value)
+{
return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-9223372036854775808"));
-}
-
-template <>
-char* WriteIntToBufferBackwards(char* ptr, ui32 value)
-{
- return WriteUnsignedIntToBufferBackwardsImpl(ptr, value);
-}
-
-template <>
-char* WriteIntToBufferBackwards(char* ptr, ui64 value)
-{
- return WriteUnsignedIntToBufferBackwardsImpl(ptr, value);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
+}
+
+template <>
+char* WriteIntToBufferBackwards(char* ptr, ui32 value)
+{
+ return WriteUnsignedIntToBufferBackwardsImpl(ptr, value);
+}
+
+template <>
+char* WriteIntToBufferBackwards(char* ptr, ui64 value)
+{
+ return WriteUnsignedIntToBufferBackwardsImpl(ptr, value);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
size_t TCaseInsensitiveStringHasher::operator()(TStringBuf arg) const
{
auto compute = [&] (char* buffer) {
@@ -240,33 +240,33 @@ bool TCaseInsensitiveStringEqualityComparer::operator()(TStringBuf lhs, TStringB
////////////////////////////////////////////////////////////////////////////////
bool TryParseBool(TStringBuf value, bool* result)
-{
- if (value == "true" || value == "1") {
+{
+ if (value == "true" || value == "1") {
*result = true;
- return true;
- } else if (value == "false" || value == "0") {
+ return true;
+ } else if (value == "false" || value == "0") {
*result = false;
- return true;
- } else {
- return false;
- }
-}
-
+ return true;
+ } else {
+ return false;
+ }
+}
+
bool ParseBool(TStringBuf value)
-{
- bool result;
+{
+ bool result;
if (!TryParseBool(value, &result)) {
throw TSimpleException(Format("Error parsing boolean value %Qv",
value));
- }
- return result;
-}
-
-TStringBuf FormatBool(bool value)
-{
- return value ? TStringBuf("true") : TStringBuf("false");
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
+ }
+ return result;
+}
+
+TStringBuf FormatBool(bool value)
+{
+ return value ? TStringBuf("true") : TStringBuf("false");
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
} // namespace NYT
diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h
index 584cc6c2e0..ae6c99caab 100644
--- a/library/cpp/yt/string/string.h
+++ b/library/cpp/yt/string/string.h
@@ -4,16 +4,16 @@
#include <library/cpp/yt/exception/exception.h>
-#include <util/datetime/base.h>
-
-#include <util/generic/string.h>
-
+#include <util/datetime/base.h>
+
+#include <util/generic/string.h>
+
#include <util/string/strip.h>
-#include <vector>
-#include <set>
-#include <map>
-
+#include <vector>
+#include <set>
+#include <map>
+
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
@@ -194,12 +194,12 @@ TString Trim(const TString& str, const TString& whitespaces);
////////////////////////////////////////////////////////////////////////////////
-//! Implemented for |[u]i(32|64)|.
-template <class T>
-char* WriteIntToBufferBackwards(char* ptr, T value);
-
-////////////////////////////////////////////////////////////////////////////////
-
+//! Implemented for |[u]i(32|64)|.
+template <class T>
+char* WriteIntToBufferBackwards(char* ptr, T value);
+
+////////////////////////////////////////////////////////////////////////////////
+
struct TCaseInsensitiveStringHasher
{
size_t operator()(TStringBuf arg) const;
@@ -214,8 +214,8 @@ struct TCaseInsensitiveStringEqualityComparer
bool TryParseBool(TStringBuf value, bool* result);
bool ParseBool(TStringBuf value);
-TStringBuf FormatBool(bool value);
-
-////////////////////////////////////////////////////////////////////////////////
-
+TStringBuf FormatBool(bool value);
+
+////////////////////////////////////////////////////////////////////////////////
+
} // namespace NYT
diff --git a/library/cpp/yt/string/string_builder-inl.h b/library/cpp/yt/string/string_builder-inl.h
index 71787fe072..151fcabf7f 100644
--- a/library/cpp/yt/string/string_builder-inl.h
+++ b/library/cpp/yt/string/string_builder-inl.h
@@ -46,11 +46,11 @@ inline void TStringBuilderBase::AppendChar(char ch)
inline void TStringBuilderBase::AppendChar(char ch, int n)
{
YT_ASSERT(n >= 0);
- if (Y_LIKELY(0 != n)) {
- char* dst = Preallocate(n);
- ::memset(dst, ch, n);
- Advance(n);
- }
+ if (Y_LIKELY(0 != n)) {
+ char* dst = Preallocate(n);
+ ::memset(dst, ch, n);
+ Advance(n);
+ }
}
inline void TStringBuilderBase::AppendString(TStringBuf str)
diff --git a/library/cpp/yt/string/unittests/enum_ut.cpp b/library/cpp/yt/string/unittests/enum_ut.cpp
index 94009eac12..b8076fd8ee 100644
--- a/library/cpp/yt/string/unittests/enum_ut.cpp
+++ b/library/cpp/yt/string/unittests/enum_ut.cpp
@@ -1,7 +1,7 @@
-#include <library/cpp/testing/gtest/gtest.h>
+#include <library/cpp/testing/gtest/gtest.h>
-#include <library/cpp/yt/string/enum.h>
-#include <library/cpp/yt/string/format.h>
+#include <library/cpp/yt/string/enum.h>
+#include <library/cpp/yt/string/format.h>
#include <limits>
@@ -58,4 +58,4 @@ TEST(TFormatTest, Enum)
} // namespace
} // namespace NYT
-
+
diff --git a/library/cpp/yt/string/unittests/format_ut.cpp b/library/cpp/yt/string/unittests/format_ut.cpp
index 356c855209..ee069bb2c0 100644
--- a/library/cpp/yt/string/unittests/format_ut.cpp
+++ b/library/cpp/yt/string/unittests/format_ut.cpp
@@ -1,9 +1,9 @@
-#include <library/cpp/testing/gtest/gtest.h>
+#include <library/cpp/testing/gtest/gtest.h>
#include <library/cpp/yt/string/format.h>
#include <library/cpp/yt/small_containers/compact_vector.h>
-
+
#include <limits>
namespace NYT {
diff --git a/library/cpp/yt/string/unittests/guid_ut.cpp b/library/cpp/yt/string/unittests/guid_ut.cpp
index a54ca206d3..4b5eebea16 100644
--- a/library/cpp/yt/string/unittests/guid_ut.cpp
+++ b/library/cpp/yt/string/unittests/guid_ut.cpp
@@ -1,7 +1,7 @@
-#include <library/cpp/testing/gtest/gtest.h>
+#include <library/cpp/testing/gtest/gtest.h>
-#include <library/cpp/yt/string/guid.h>
-#include <library/cpp/yt/string/format.h>
+#include <library/cpp/yt/string/guid.h>
+#include <library/cpp/yt/string/format.h>
#include <util/string/hex.h>
@@ -10,7 +10,7 @@ namespace {
////////////////////////////////////////////////////////////////////////////////
-static_assert(TFormatTraits<TGuid>::HasCustomFormatValue);
+static_assert(TFormatTraits<TGuid>::HasCustomFormatValue);
TString CanonicalToString(TGuid value)
{
diff --git a/library/cpp/yt/string/unittests/string_ut.cpp b/library/cpp/yt/string/unittests/string_ut.cpp
index 5671b25710..3e12312af0 100644
--- a/library/cpp/yt/string/unittests/string_ut.cpp
+++ b/library/cpp/yt/string/unittests/string_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/gtest/gtest.h>
+#include <library/cpp/testing/gtest/gtest.h>
#include <library/cpp/yt/string/string.h>
diff --git a/library/cpp/yt/string/unittests/ya.make b/library/cpp/yt/string/unittests/ya.make
index 36aecb0857..9d539758d1 100644
--- a/library/cpp/yt/string/unittests/ya.make
+++ b/library/cpp/yt/string/unittests/ya.make
@@ -1,17 +1,17 @@
-GTEST(unittester-library-string-helpers)
-
-OWNER(g:yt)
-
-SRCS(
- enum_ut.cpp
- format_ut.cpp
- guid_ut.cpp
- string_ut.cpp
-)
-
-PEERDIR(
+GTEST(unittester-library-string-helpers)
+
+OWNER(g:yt)
+
+SRCS(
+ enum_ut.cpp
+ format_ut.cpp
+ guid_ut.cpp
+ string_ut.cpp
+)
+
+PEERDIR(
library/cpp/yt/string
- library/cpp/testing/gtest
-)
-
-END()
+ library/cpp/testing/gtest
+)
+
+END()
diff --git a/library/cpp/yt/string/ya.make b/library/cpp/yt/string/ya.make
index 61a4ba45d2..83efd5eb2f 100644
--- a/library/cpp/yt/string/ya.make
+++ b/library/cpp/yt/string/ya.make
@@ -1,30 +1,30 @@
-LIBRARY()
-
-SRCS(
- enum.cpp
- guid.cpp
- string.cpp
-)
-
-PEERDIR(
+LIBRARY()
+
+SRCS(
+ enum.cpp
+ guid.cpp
+ string.cpp
+)
+
+PEERDIR(
library/cpp/yt/assert
library/cpp/yt/exception
- library/cpp/yt/misc
-)
-
-CHECK_DEPENDENT_DIRS(
- ALLOW_ONLY ALL
- build
- contrib
- library
- util
+ library/cpp/yt/misc
+)
+
+CHECK_DEPENDENT_DIRS(
+ ALLOW_ONLY ALL
+ build
+ contrib
+ library
+ util
library/cpp/yt/assert
- library/cpp/yt/misc
+ library/cpp/yt/misc
library/cpp/yt/small_containers
-)
-
-END()
-
-RECURSE_FOR_TESTS(
- unittests
-)
+)
+
+END()
+
+RECURSE_FOR_TESTS(
+ unittests
+)
diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp
index 9be8db3e20..99d45e8616 100644
--- a/library/cpp/yt/yson_string/string.cpp
+++ b/library/cpp/yt/yson_string/string.cpp
@@ -1,4 +1,4 @@
-#include "string.h"
+#include "string.h"
#include <library/cpp/yt/assert/assert.h>
diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h
index 2f6ee15a99..e13af37a6d 100644
--- a/library/cpp/yt/yson_string/string.h
+++ b/library/cpp/yt/yson_string/string.h
@@ -24,7 +24,7 @@ public:
//! Constructs a non-null instance with given type and content.
explicit TYsonStringBuf(
const TString& data,
- EYsonType type = EYsonType::Node);
+ EYsonType type = EYsonType::Node);
//! Constructs a non-null instance with given type and content.
explicit TYsonStringBuf(
diff --git a/library/python/pytest/plugins/ya.py b/library/python/pytest/plugins/ya.py
index be9e1ac8e4..1bde03042d 100644
--- a/library/python/pytest/plugins/ya.py
+++ b/library/python/pytest/plugins/ya.py
@@ -407,8 +407,8 @@ def pytest_runtest_teardown(item, nextitem):
def pytest_runtest_call(item):
- class_name, test_name = tools.split_node_id(item.nodeid)
- yatest_logger.info("Test call (class_name: %s, test_name: %s)", class_name, test_name)
+ class_name, test_name = tools.split_node_id(item.nodeid)
+ yatest_logger.info("Test call (class_name: %s, test_name: %s)", class_name, test_name)
def pytest_deselected(items):