aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorcobat <cobat@yandex-team.ru>2022-02-10 16:49:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:07 +0300
commit1d2e8a8e9976488ea69a7e4763aa749244f82612 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util
parente486e109b08823b61996f2154f0bc6b7c27a4af4 (diff)
downloadydb-1d2e8a8e9976488ea69a7e4763aa749244f82612.tar.gz
Restoring authorship annotation for <cobat@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/README.md36
-rw-r--r--util/folder/iterator_ut.cpp2
-rw-r--r--util/generic/benchmark/log2/main.cpp88
-rw-r--r--util/generic/yexception_ut.cpp2
-rw-r--r--util/memory/blob.h84
-rw-r--r--util/network/iovec.h2
-rw-r--r--util/network/socket.cpp2
-rw-r--r--util/string/cast.cpp6
-rw-r--r--util/string/strip.h14
-rw-r--r--util/string/type.h6
-rw-r--r--util/string/util.h10
-rw-r--r--util/system/hp_timer.h8
-rw-r--r--util/system/rwlock.cpp4
-rw-r--r--util/system/types.h2
-rw-r--r--util/ysafeptr.h26
15 files changed, 146 insertions, 146 deletions
diff --git a/util/README.md b/util/README.md
index b4c4785e77..496efa633c 100644
--- a/util/README.md
+++ b/util/README.md
@@ -4,37 +4,37 @@ Style guide for the util folder is a stricter version of
[general style guide](https://docs.yandex-team.ru/arcadia-cpp/cpp_style_guide)
(mostly in terms of ambiguity resolution).
- * all {} must be in K&R style
- * &, * tied closer to a type, not to variable
- * always use `using` not `typedef`
- * even a single line block must be in braces {}:
+ * all {} must be in K&R style
+ * &, * tied closer to a type, not to variable
+ * always use `using` not `typedef`
+ * even a single line block must be in braces {}:
```
if (A) {
B();
}
```
- * _ at the end of private data member of a class - `First_`, `Second_`
- * every .h file must be accompanied with corresponding .cpp to avoid a leakage and check that it is self contained
- * prohibited to use `printf`-like functions
+ * _ at the end of private data member of a class - `First_`, `Second_`
+ * every .h file must be accompanied with corresponding .cpp to avoid a leakage and check that it is self contained
+ * prohibited to use `printf`-like functions
-Things declared in the general style guide, which sometimes are missed:
+Things declared in the general style guide, which sometimes are missed:
- * `template <`, not `template<`
- * `noexcept`, not `throw ()` nor `throw()`, not required for destructors
- * indents inside `namespace` same as inside `class`
+ * `template <`, not `template<`
+ * `noexcept`, not `throw ()` nor `throw()`, not required for destructors
+ * indents inside `namespace` same as inside `class`
-Requirements for a new code (and for corrections in an old code which involves change of behaviour) in util:
+Requirements for a new code (and for corrections in an old code which involves change of behaviour) in util:
- * presence of UNIT-tests
- * presence of comments in Doxygen style
- * accessors without Get prefix (`Length()`, but not `GetLength()`)
+ * presence of UNIT-tests
+ * presence of comments in Doxygen style
+ * accessors without Get prefix (`Length()`, but not `GetLength()`)
-This guide is not a mandatory as there is the general style guide.
-Nevertheless if it is not followed, then a next `ya style .` run in the util folder will undeservedly update authors of some lines of code.
+This guide is not a mandatory as there is the general style guide.
+Nevertheless if it is not followed, then a next `ya style .` run in the util folder will undeservedly update authors of some lines of code.
-Thus before a commit it is recommended to run `ya style .` in the util folder.
+Thus before a commit it is recommended to run `ya style .` in the util folder.
Don't forget to run tests from folder `tests`: `ya make -t tests`
diff --git a/util/folder/iterator_ut.cpp b/util/folder/iterator_ut.cpp
index d8e0cf892d..936becd139 100644
--- a/util/folder/iterator_ut.cpp
+++ b/util/folder/iterator_ut.cpp
@@ -60,7 +60,7 @@ private:
break;
case 2:
- ythrow yexception() << "unknown path type";
+ ythrow yexception() << "unknown path type";
}
Paths_.push_back(path);
diff --git a/util/generic/benchmark/log2/main.cpp b/util/generic/benchmark/log2/main.cpp
index 44db7bf4cf..969f09a309 100644
--- a/util/generic/benchmark/log2/main.cpp
+++ b/util/generic/benchmark/log2/main.cpp
@@ -14,8 +14,8 @@ namespace {
TVector<T> Examples;
TExamplesHolder()
- : Examples(N)
- {
+ : Examples(N)
+ {
TFastRng<ui64> prng{N * 42};
for (auto& x : Examples) {
x = prng.GenRandReal4() + prng.Uniform(1932); // 1934 is just a random number
@@ -25,25 +25,25 @@ namespace {
}
#define DEFINE_BENCHMARK(type, count) \
- Y_CPU_BENCHMARK(libm_log2f_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(log2f(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(libm_logf_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(logf(e)); \
- } \
- } \
- } \
+ Y_CPU_BENCHMARK(libm_log2f_##type##_##count, iface) { \
+ const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
+ for (const auto i : xrange(iface.Iterations())) { \
+ Y_UNUSED(i); \
+ for (const auto e : examples) { \
+ Y_DO_NOT_OPTIMIZE_AWAY(log2f(e)); \
+ } \
+ } \
+ } \
+ \
+ Y_CPU_BENCHMARK(libm_logf_##type##_##count, iface) { \
+ const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
+ for (const auto i : xrange(iface.Iterations())) { \
+ Y_UNUSED(i); \
+ for (const auto e : examples) { \
+ Y_DO_NOT_OPTIMIZE_AWAY(logf(e)); \
+ } \
+ } \
+ } \
Y_CPU_BENCHMARK(STL_Log2_##type##_##count, iface) { \
const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
for (const auto i : xrange(iface.Iterations())) { \
@@ -74,7 +74,7 @@ namespace {
} \
} \
\
- Y_CPU_BENCHMARK(FastLogf##type##_##count, iface) { \
+ Y_CPU_BENCHMARK(FastLogf##type##_##count, iface) { \
const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
for (const auto i : xrange(iface.Iterations())) { \
Y_UNUSED(i); \
@@ -89,7 +89,7 @@ namespace {
for (const auto i : xrange(iface.Iterations())) { \
Y_UNUSED(i); \
for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FasterLog2f(e)); \
+ Y_DO_NOT_OPTIMIZE_AWAY(FasterLog2f(e)); \
} \
} \
} \
@@ -99,29 +99,29 @@ namespace {
for (const auto i : xrange(iface.Iterations())) { \
Y_UNUSED(i); \
for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FasterLogf(e)); \
+ Y_DO_NOT_OPTIMIZE_AWAY(FasterLogf(e)); \
+ } \
+ } \
+ } \
+ \
+ Y_CPU_BENCHMARK(Fastest_Log2f_##type##_##count, iface) { \
+ const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
+ for (const auto i : xrange(iface.Iterations())) { \
+ Y_UNUSED(i); \
+ for (const auto e : examples) { \
+ Y_DO_NOT_OPTIMIZE_AWAY(FastestLog2f(e)); \
+ } \
+ } \
+ } \
+ \
+ Y_CPU_BENCHMARK(Fastest_Log_##type##_##count, iface) { \
+ const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
+ for (const auto i : xrange(iface.Iterations())) { \
+ Y_UNUSED(i); \
+ for (const auto e : examples) { \
+ Y_DO_NOT_OPTIMIZE_AWAY(FastestLogf(e)); \
} \
} \
- } \
- \
- Y_CPU_BENCHMARK(Fastest_Log2f_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FastestLog2f(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Fastest_Log_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FastestLogf(e)); \
- } \
- } \
}
DEFINE_BENCHMARK(float, 1)
diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp
index cf085f8fc9..cb3e29fed8 100644
--- a/util/generic/yexception_ut.cpp
+++ b/util/generic/yexception_ut.cpp
@@ -59,7 +59,7 @@ private:
inline void TestRethrowAppend() {
try {
try {
- ythrow yexception() << "it";
+ ythrow yexception() << "it";
} catch (yexception& e) {
e << "happens";
diff --git a/util/memory/blob.h b/util/memory/blob.h
index 4708ea6d1f..20c02a68df 100644
--- a/util/memory/blob.h
+++ b/util/memory/blob.h
@@ -61,7 +61,7 @@ public:
using const_iterator = const_pointer;
/**
- * Constructs a null blob (data array points to nullptr).
+ * Constructs a null blob (data array points to nullptr).
*/
TBlob() noexcept
: S_(nullptr, 0, nullptr)
@@ -96,22 +96,22 @@ public:
return *this;
}
- /// Swaps content of two data arrays.
+ /// Swaps content of two data arrays.
inline void Swap(TBlob& r) noexcept {
S_.Swap(r.S_);
}
- /// Returns a const reference to the data array.
+ /// Returns a const reference to the data array.
inline const void* Data() const noexcept {
return S_.Data;
}
- /// Returns the size of the data array in bytes.
+ /// Returns the size of the data array in bytes.
inline size_t Length() const noexcept {
return S_.Length;
}
- /// Checks if the object has an empty data array.
+ /// Checks if the object has an empty data array.
Y_PURE_FUNCTION inline bool Empty() const noexcept {
return !Length();
}
@@ -121,17 +121,17 @@ public:
return S_.Base != nullptr;
}
- /// Checks if the object has a data array.
+ /// Checks if the object has a data array.
inline bool IsNull() const noexcept {
return !Data();
}
- /// Returns a const pointer of char type to the data array.
+ /// Returns a const pointer of char type to the data array.
inline const char* AsCharPtr() const noexcept {
return (const char*)Data();
}
- /// Returns a const pointer of unsigned char type to the data array.
+ /// Returns a const pointer of unsigned char type to the data array.
inline const unsigned char* AsUnsignedCharPtr() const noexcept {
return (const unsigned char*)Data();
}
@@ -140,13 +140,13 @@ public:
return TStringBuf(AsCharPtr(), size());
}
- /// Drops the data array.
+ /// Drops the data array.
inline void Drop() noexcept {
TBlob().Swap(*this);
}
/*
- * Some stl-like methods
+ * Some stl-like methods
*/
/// Returns a const reference to the data array.
@@ -157,7 +157,7 @@ public:
return static_cast<const_pointer>(Data());
}
- /// Returns the size of the data array in bytes.
+ /// Returns the size of the data array in bytes.
inline size_t size() const noexcept {
return Length();
}
@@ -167,12 +167,12 @@ public:
return Length();
}
- /// Standard iterator.
+ /// Standard iterator.
inline const_iterator Begin() const noexcept {
return AsUnsignedCharPtr();
}
- /// Standard iterator.
+ /// Standard iterator.
inline const_iterator End() const noexcept {
return Begin() + Size();
}
@@ -181,26 +181,26 @@ public:
return *(Begin() + n);
}
- /// Shortcut to SubBlob(0, len)
+ /// Shortcut to SubBlob(0, len)
TBlob SubBlob(size_t len) const;
- /// Creates a new object from the provided range [begin, end) of internal data. No memory allocation and no copy.
- /// @details Increments the refcounter of the current object
+ /// Creates a new object from the provided range [begin, end) of internal data. No memory allocation and no copy.
+ /// @details Increments the refcounter of the current object
TBlob SubBlob(size_t begin, size_t end) const;
- /// Calls Copy() for the internal data.
+ /// Calls Copy() for the internal data.
TBlob DeepCopy() const;
- /// Creates a new blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies the data content.
+ /// Creates a new blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies the data content.
static TBlob CopySingleThreaded(const void* data, size_t length);
- /// Creates a new blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies the data content.
+ /// Creates a new blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies the data content.
static TBlob Copy(const void* data, size_t length);
- /// Creates a blob which doesn't own data. No refcounter, no memory allocation, no data copy.
+ /// Creates a blob which doesn't own data. No refcounter, no memory allocation, no data copy.
static TBlob NoCopy(const void* data, size_t length);
- /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
+ /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
static TBlob FromFileSingleThreaded(const TString& path, EMappingMode);
/// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
@@ -215,27 +215,27 @@ public:
/// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
static TBlob FromFileSingleThreaded(const TString& path);
- /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
+ /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
static TBlob FromFile(const TString& path);
- /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
+ /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
static TBlob FromFileSingleThreaded(const TFile& file);
- /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
+ /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
static TBlob FromFile(const TFile& file);
// TODO: drop Precharged* functions.
- /// Creates a precharged blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
+ /// Creates a precharged blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
static TBlob PrechargedFromFileSingleThreaded(const TString& path);
- /// Creates a precharged blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
+ /// Creates a precharged blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
static TBlob PrechargedFromFile(const TString& path);
- /// Creates a precharged blob with a single-threaded (non atomic) refcounter. It maps the file content as data.
+ /// Creates a precharged blob with a single-threaded (non atomic) refcounter. It maps the file content as data.
static TBlob PrechargedFromFileSingleThreaded(const TFile& file);
- /// Creates a precharged blob with a multi-threaded (atomic) refcounter. It maps the file content as data.
+ /// Creates a precharged blob with a multi-threaded (atomic) refcounter. It maps the file content as data.
static TBlob PrechargedFromFile(const TFile& file);
/// Creates a locked blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
@@ -256,42 +256,42 @@ public:
/// Creates a locked blob with a multi-threaded (atomic) refcounter from the mapped memory.
static TBlob LockedFromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length);
- /// Creates a blob with a single-threaded (non atomic) refcounter from the mapped memory.
+ /// Creates a blob with a single-threaded (non atomic) refcounter from the mapped memory.
static TBlob FromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length);
- /// Creates a blob with a multi-threaded (atomic) refcounter from the mapped memory.
+ /// Creates a blob with a multi-threaded (atomic) refcounter from the mapped memory.
static TBlob FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length);
- /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread().
+ /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread().
static TBlob FromFileContentSingleThreaded(const TString& path);
- /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread().
+ /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread().
static TBlob FromFileContent(const TString& path);
- /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file using pread().
+ /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file using pread().
static TBlob FromFileContentSingleThreaded(const TFile& file);
- /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file using pread().
+ /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file using pread().
static TBlob FromFileContent(const TFile& file);
- /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the provided range of the file content using pread().
+ /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the provided range of the file content using pread().
static TBlob FromFileContentSingleThreaded(const TFile& file, ui64 offset, size_t length);
- /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the provided range of the file content using pread().
+ /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the provided range of the file content using pread().
static TBlob FromFileContent(const TFile& file, ui64 offset, size_t length);
- /// Creates a blob from the stream content with a single-threaded (non atomic) refcounter.
+ /// Creates a blob from the stream content with a single-threaded (non atomic) refcounter.
static TBlob FromStreamSingleThreaded(IInputStream& in);
- /// Creates a blob from the stream content with a multi-threaded (atomic) refcounter.
+ /// Creates a blob from the stream content with a multi-threaded (atomic) refcounter.
static TBlob FromStream(IInputStream& in);
- /// Creates a blob with a single-threaded (non atomic) refcounter. No memory allocation, no content copy.
- /// @details The input object becomes empty.
+ /// Creates a blob with a single-threaded (non atomic) refcounter. No memory allocation, no content copy.
+ /// @details The input object becomes empty.
static TBlob FromBufferSingleThreaded(TBuffer& in);
- /// Creates a blob with a multi-threaded (atomic) refcounter. No memory allocation, no content copy.
- /// @details The input object becomes empty.
+ /// Creates a blob with a multi-threaded (atomic) refcounter. No memory allocation, no content copy.
+ /// @details The input object becomes empty.
static TBlob FromBuffer(TBuffer& in);
/// Creates a blob from TString with a single-threaded (non atomic) refcounter.
diff --git a/util/network/iovec.h b/util/network/iovec.h
index 1ba5d0f18b..ac15a41f54 100644
--- a/util/network/iovec.h
+++ b/util/network/iovec.h
@@ -29,7 +29,7 @@ public:
}
if (len) {
- Y_ASSERT(0 && "non zero length left");
+ Y_ASSERT(0 && "non zero length left");
}
}
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 9061372b90..4f6e804346 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -695,7 +695,7 @@ static inline SOCKET DoConnectImpl(const struct addrinfo* res, const TInstant& d
return s.Release();
}
- ythrow yexception() << "something went wrong: nullptr at addrinfo";
+ ythrow yexception() << "something went wrong: nullptr at addrinfo";
}
static inline SOCKET DoConnect(const struct addrinfo* res, const TInstant& deadLine) {
diff --git a/util/string/cast.cpp b/util/string/cast.cpp
index 560fb22044..aa1e65a8e9 100644
--- a/util/string/cast.cpp
+++ b/util/string/cast.cpp
@@ -788,7 +788,7 @@ namespace {
static inline size_t DoDtoa(double d, char* buf, size_t len, int prec) noexcept {
TBuilder sb(buf, len);
- Y_VERIFY(ToStringConverterNoPad().ToPrecision(d, prec, sb.SB), "conversion failed");
+ Y_VERIFY(ToStringConverterNoPad().ToPrecision(d, prec, sb.SB), "conversion failed");
return FixEnd(buf, FixZeros(buf, sb.SB->position()));
}
@@ -808,7 +808,7 @@ size_t FloatToString(float t, char* buf, size_t len, EFloatToStringMode mode, in
if (mode == PREC_AUTO) {
TBuilder sb(buf, len);
- Y_VERIFY(ToStringConverterNoPad().ToShortestSingle(t, sb.SB), "conversion failed");
+ Y_VERIFY(ToStringConverterNoPad().ToShortestSingle(t, sb.SB), "conversion failed");
return FixEnd(buf, sb.SB->position());
}
@@ -827,7 +827,7 @@ size_t FloatToString(double t, char* buf, size_t len, EFloatToStringMode mode, i
TBuilder sb(buf, len);
if (mode == PREC_AUTO) {
- Y_VERIFY(ToStringConverterNoPad().ToShortest(t, sb.SB), "conversion failed");
+ Y_VERIFY(ToStringConverterNoPad().ToShortest(t, sb.SB), "conversion failed");
return FixEnd(buf, sb.SB->position());
}
diff --git a/util/string/strip.h b/util/string/strip.h
index cde1e1d038..d5ef6da96d 100644
--- a/util/string/strip.h
+++ b/util/string/strip.h
@@ -177,18 +177,18 @@ static inline T StripStringRight(const T& from, TStripCriterion&& criterion) {
return TStripImpl<false, true>::StripString(from, criterion);
}
-/// Copies the given string removing leading and trailing spaces.
+/// Copies the given string removing leading and trailing spaces.
static inline bool Strip(const TString& from, TString& to) {
return StripString(from, to);
}
-/// Removes leading and trailing spaces from the string.
+/// Removes leading and trailing spaces from the string.
inline TString& StripInPlace(TString& s) {
Strip(s, s);
return s;
}
-/// Returns a copy of the given string with removed leading and trailing spaces.
+/// Returns a copy of the given string with removed leading and trailing spaces.
inline TString Strip(const TString& s) Y_WARN_UNUSED_RESULT;
inline TString Strip(const TString& s) {
TString ret = s;
@@ -232,13 +232,13 @@ bool CollapseImpl(const TStringType& from, TStringType& to, size_t maxLen, const
bool Collapse(const TString& from, TString& to, size_t maxLen = 0);
-/// Replaces several consequtive space symbols with one (processing is limited to maxLen bytes)
+/// Replaces several consequtive space symbols with one (processing is limited to maxLen bytes)
inline TString& CollapseInPlace(TString& s, size_t maxLen = 0) {
Collapse(s, s, maxLen);
return s;
}
-/// Replaces several consequtive space symbols with one (processing is limited to maxLen bytes)
+/// Replaces several consequtive space symbols with one (processing is limited to maxLen bytes)
inline TString Collapse(const TString& s, size_t maxLen = 0) Y_WARN_UNUSED_RESULT;
inline TString Collapse(const TString& s, size_t maxLen) {
TString ret;
@@ -248,8 +248,8 @@ inline TString Collapse(const TString& s, size_t maxLen) {
void CollapseText(const TString& from, TString& to, size_t maxLen);
-/// The same as Collapse() + truncates the string to maxLen.
-/// @details An ellipsis is inserted at the end of the truncated line.
+/// The same as Collapse() + truncates the string to maxLen.
+/// @details An ellipsis is inserted at the end of the truncated line.
inline void CollapseText(TString& s, size_t maxLen) {
TString to;
CollapseText(s, to, maxLen);
diff --git a/util/string/type.h b/util/string/type.h
index 9602f260d1..d6cb29ea58 100644
--- a/util/string/type.h
+++ b/util/string/type.h
@@ -4,17 +4,17 @@
Y_PURE_FUNCTION bool IsSpace(const char* s, size_t len) noexcept;
-/// Checks if a string is a set of only space symbols.
+/// Checks if a string is a set of only space symbols.
Y_PURE_FUNCTION static inline bool IsSpace(const TStringBuf s) noexcept {
return IsSpace(s.data(), s.size());
}
-/// Returns "true" if the given string is an arabic number ([0-9]+)
+/// Returns "true" if the given string is an arabic number ([0-9]+)
Y_PURE_FUNCTION bool IsNumber(const TStringBuf s) noexcept;
Y_PURE_FUNCTION bool IsNumber(const TWtringBuf s) noexcept;
-/// Returns "true" if the given string is a hex number ([0-9a-fA-F]+)
+/// Returns "true" if the given string is a hex number ([0-9a-fA-F]+)
Y_PURE_FUNCTION bool IsHexNumber(const TStringBuf s) noexcept;
Y_PURE_FUNCTION bool IsHexNumber(const TWtringBuf s) noexcept;
diff --git a/util/string/util.h b/util/string/util.h
index a958a7a1a4..0d77a5042b 100644
--- a/util/string/util.h
+++ b/util/string/util.h
@@ -14,7 +14,7 @@
/// @{
int a2i(const TString& s);
-/// Removes the last character if it is equal to c.
+/// Removes the last character if it is equal to c.
template <class T>
inline void RemoveIfLast(T& s, int c) {
const size_t length = s.length();
@@ -22,7 +22,7 @@ inline void RemoveIfLast(T& s, int c) {
s.remove(length - 1);
}
-/// Adds lastCh symbol to the the of the string if it is not already there.
+/// Adds lastCh symbol to the the of the string if it is not already there.
inline void addIfNotLast(TString& s, int lastCh) {
size_t len = s.length();
if (!len || s[len - 1] != lastCh) {
@@ -30,9 +30,9 @@ inline void addIfNotLast(TString& s, int lastCh) {
}
}
-/// @details Finishes the string with lastCh1 if lastCh2 is not present in the string and lastCh1 is not already at the end of the string.
-/// Else, if lastCh2 is not equal to the symbol before the last, it finishes the string with lastCh2.
-/// @todo ?? Define, when to apply the function. Is in use several times for URLs parsing.
+/// @details Finishes the string with lastCh1 if lastCh2 is not present in the string and lastCh1 is not already at the end of the string.
+/// Else, if lastCh2 is not equal to the symbol before the last, it finishes the string with lastCh2.
+/// @todo ?? Define, when to apply the function. Is in use several times for URLs parsing.
inline void addIfAbsent(TString& s, char lastCh1, char lastCh2) {
size_t pos = s.find(lastCh2);
if (pos == TString::npos) {
diff --git a/util/system/hp_timer.h b/util/system/hp_timer.h
index e9ab10ec26..0a4c252ec2 100644
--- a/util/system/hp_timer.h
+++ b/util/system/hp_timer.h
@@ -4,13 +4,13 @@
namespace NHPTimer {
using STime = i64;
- // May delay for ~50ms to compute frequency
+ // May delay for ~50ms to compute frequency
double GetSeconds(const STime& a) noexcept;
- // Returns the current time
+ // Returns the current time
void GetTime(STime* pTime) noexcept;
- // Returns the time passed since *pTime, and writes the current time into *pTime.
+ // Returns the time passed since *pTime, and writes the current time into *pTime.
double GetTimePassed(STime* pTime) noexcept;
- // Get TSC frequency, may delay for ~50ms to compute frequency
+ // Get TSC frequency, may delay for ~50ms to compute frequency
double GetClockRate() noexcept;
// same as GetClockRate, but in integer
ui64 GetCyclesPerSecond() noexcept;
diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp
index abe7435960..bb3dcbf188 100644
--- a/util/system/rwlock.cpp
+++ b/util/system/rwlock.cpp
@@ -41,8 +41,8 @@ TRWMutex::TImpl::TImpl()
}
TRWMutex::TImpl::~TImpl() {
- Y_VERIFY(State_ == 0, "failure, State_ != 0");
- Y_VERIFY(BlockedWriters_ == 0, "failure, BlockedWriters_ != 0");
+ Y_VERIFY(State_ == 0, "failure, State_ != 0");
+ Y_VERIFY(BlockedWriters_ == 0, "failure, BlockedWriters_ != 0");
}
void TRWMutex::TImpl::AcquireRead() noexcept {
diff --git a/util/system/types.h b/util/system/types.h
index 3408749656..12e68a6060 100644
--- a/util/system/types.h
+++ b/util/system/types.h
@@ -33,7 +33,7 @@ typedef int64_t i64;
#define LL(number) INT64_C(number)
#define ULL(number) UINT64_C(number)
-// Macro for size_t and ptrdiff_t types
+// Macro for size_t and ptrdiff_t types
#if defined(_32_)
#if defined(_darwin_)
#define PRISZT "lu"
diff --git a/util/ysafeptr.h b/util/ysafeptr.h
index d9678ff93a..af7dfd4bed 100644
--- a/util/ysafeptr.h
+++ b/util/ysafeptr.h
@@ -6,20 +6,20 @@
#include <util/system/tls.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
-// There are different templates of pointers:
-// 1. Simple pointers.
-// 2. TPtr with refereces.
-// 3. TObj/TMObj with ownership. After destruction of a TObj the object it referenced to is
-// cleaned up and marked as non valid. Similarly does TMobj organizing the parallel ownership
-// of an object.
-//
-// Limitations:
-// 1. It may be necessary to use BASIC_REGISTER_CLASS() in .cpp files to be able to use a
-// pointer to a forward declared class.
-// 2. It's prohibited to override the 'new' operator, since the standard 'delete' will be used
-// for destruction of objects (because of 'delete this').
+// There are different templates of pointers:
+// 1. Simple pointers.
+// 2. TPtr with refereces.
+// 3. TObj/TMObj with ownership. After destruction of a TObj the object it referenced to is
+// cleaned up and marked as non valid. Similarly does TMobj organizing the parallel ownership
+// of an object.
+//
+// Limitations:
+// 1. It may be necessary to use BASIC_REGISTER_CLASS() in .cpp files to be able to use a
+// pointer to a forward declared class.
+// 2. It's prohibited to override the 'new' operator, since the standard 'delete' will be used
+// for destruction of objects (because of 'delete this').
////////////////////////////////////////////////////////////////////////////////////////////////////
-
+
#if defined(_MSC_VER) && defined(_DEBUG)
#include <util/system/winint.h>
#define CHECK_YPTR2