aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authoriseg <iseg@yandex-team.ru>2022-02-10 16:49:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:39 +0300
commit8b71ce88bea710a9663bb143e4916f961c57212e (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util
parentf828a15ab90e9ca8e848f83caf95c95f06be46e7 (diff)
downloadydb-8b71ce88bea710a9663bb143e4916f961c57212e.tar.gz
Restoring authorship annotation for <iseg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/charset/unidata.h130
-rw-r--r--util/datetime/base.h10
-rw-r--r--util/generic/strbase.h2
-rw-r--r--util/generic/string.cpp12
-rw-r--r--util/generic/string.h10
-rw-r--r--util/memory/alloc.h2
-rw-r--r--util/str_stl.h6
-rw-r--r--util/stream/file.h2
-rw-r--r--util/string/util.h2
-rw-r--r--util/system/compat.cpp2
-rw-r--r--util/system/compat.h8
-rw-r--r--util/system/defaults.h28
-rw-r--r--util/system/filemap.cpp12
-rw-r--r--util/system/filemap.h12
-rw-r--r--util/system/maxlen.h2
-rw-r--r--util/system/mutex.cpp30
-rw-r--r--util/system/mutex.h8
-rw-r--r--util/system/sys_alloc.h2
-rw-r--r--util/system/tls.h14
-rw-r--r--util/system/yassert.h4
-rw-r--r--util/thread/pool.h6
21 files changed, 152 insertions, 152 deletions
diff --git a/util/charset/unidata.h b/util/charset/unidata.h
index 32014a8fa0..400d314186 100644
--- a/util/charset/unidata.h
+++ b/util/charset/unidata.h
@@ -1,9 +1,9 @@
#pragma once
-
+
#include "unicode_table.h"
#include <util/system/defaults.h> // wchar32, ui64, ULL()
-
+
enum WC_TYPE { // TODO move no NUnicode
Lu_UPPER = 1, // 'Ъ'
Ll_LOWER = 2, // 'ъ'
@@ -17,35 +17,35 @@ enum WC_TYPE { // TODO move no NUnicode
Lo_LEADING = 10, // '?'
Lo_VOWEL = 11, // '?'
Lo_TRAILING = 12, // '?'
-
+
Mn_NONSPACING = 13, // '`'
Me_ENCLOSING = 14, // '`'
Mc_SPACING = 15, // '`'
-
+
Nd_DIGIT = 16, // '9' // convert to digit
Nl_LETTER = 17, // 'X' // X,V,C,L,I ...
- Nl_IDEOGRAPH = 18, // '?'
+ Nl_IDEOGRAPH = 18, // '?'
No_OTHER = 19, // '9'
-
+
Zs_SPACE = 20, // ' ' [\40\240] SPACE ... NO-BREAK SPACE (00A0)
Zs_ZWSPACE = 21, // ' ' // nothing ?
Zl_LINE = 22, // '\n'
- Zp_PARAGRAPH = 23, // '\n'
-
+ Zp_PARAGRAPH = 23, // '\n'
+
Cc_ASCII = 24, // '\x1A' // can not happen
Cc_SPACE = 25, // '\x1A' // can not happen
- Cc_SEPARATOR = 26, // '\x1A' // can not happen
-
+ Cc_SEPARATOR = 26, // '\x1A' // can not happen
+
Cf_FORMAT = 27, // '\x1A' // nothing ?
Cf_JOIN = 28, // '\x1A' // nothing ?
Cf_BIDI = 29, // '\x1A' // nothing ?
Cf_ZWNBSP = 30, // '\x1A' // nothing ?
-
+
Cn_UNASSIGNED = 0, // '?'
Co_PRIVATE = 0, // '?'
Cs_LOW = 31, // '?'
Cs_HIGH = 32, // '?'
-
+
Pd_DASH = 33, // '-'
Pd_HYPHEN = 34, // '-' [-] HYPHEN-MINUS
Ps_START = 35, // '(' [([{] LEFT PARENTHESIS ... LEFT CURLY BRACKET
@@ -60,7 +60,7 @@ enum WC_TYPE { // TODO move no NUnicode
Po_TERMINAL = 44, // '.' [!,.:;?] EXCLAMATION MARK ... QUESTION MARK
Po_EXTENDER = 45, // '-' [№] MIDDLE DOT (00B7)
Po_HYPHEN = 46, // '-'
-
+
Sm_MATH = 47, // '=' [+<=>|~] PLUS SIGN ... TILDE
Sm_MINUS = 48, // '-'
Sc_CURRENCY = 49, // '$' [$] DOLLAR SIGN
@@ -75,25 +75,25 @@ enum WC_TYPE { // TODO move no NUnicode
CCL_NUM = 57,
CCL_MASK = 0x3F,
-
+
IS_ASCII_XDIGIT = 1 << 6,
IS_DIGIT = 1 << 7,
IS_NONBREAK = 1 << 8,
-
+
IS_PRIVATE = 1 << 9,
-
+
IS_COMPAT = 1 << 10,
IS_CANON = 1 << 11,
-
+
NFD_QC = 1 << 12,
NFC_QC = 1 << 13,
NFKD_QC = 1 << 14,
NFKC_QC = 1 << 15,
-
+
BIDI_OFFSET = 16,
SVAL_OFFSET = 22,
-};
-
+};
+
const size_t DEFCHAR_BUF = 58; // CCL_NUM + 1
#define SHIFT(i) (ULL(1) << (i))
@@ -144,17 +144,17 @@ namespace NUnicode {
}
}
-// all usefull properties
+// all usefull properties
inline bool IsComposed(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & (IS_COMPAT | IS_CANON);
-}
+}
inline bool IsCanonComposed(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & IS_CANON;
-}
+}
inline bool IsCompatComposed(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & IS_COMPAT;
-}
+}
inline bool IsWhitespace(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cc_SPACE) | SHIFT(Zs_SPACE) | SHIFT(Zs_ZWSPACE) | SHIFT(Zl_LINE) | SHIFT(Zp_PARAGRAPH));
@@ -164,42 +164,42 @@ inline bool IsAsciiCntrl(wchar32 ch) {
}
inline bool IsBidiCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_BIDI));
-}
+}
inline bool IsJoinCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_JOIN));
-}
+}
inline bool IsFormatCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_FORMAT));
-}
+}
inline bool IsIgnorableCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_FORMAT) | SHIFT(Cf_JOIN) | SHIFT(Cf_BIDI) | SHIFT(Cf_ZWNBSP));
-}
+}
inline bool IsCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch,
SHIFT(Cf_FORMAT) | SHIFT(Cf_JOIN) | SHIFT(Cf_BIDI) | SHIFT(Cf_ZWNBSP) |
SHIFT(Cc_ASCII) | SHIFT(Cc_SPACE) | SHIFT(Cc_SEPARATOR));
-}
+}
inline bool IsZerowidth(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_FORMAT) | SHIFT(Cf_JOIN) | SHIFT(Cf_BIDI) | SHIFT(Cf_ZWNBSP) | SHIFT(Zs_ZWSPACE));
-}
+}
inline bool IsLineSep(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Zl_LINE));
-}
+}
inline bool IsParaSep(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Zp_PARAGRAPH));
-}
+}
inline bool IsDash(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Pd_DASH) | SHIFT(Pd_HYPHEN) | SHIFT(Sm_MINUS));
-}
+}
inline bool IsHyphen(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Pd_HYPHEN) | SHIFT(Po_HYPHEN));
-}
+}
inline bool IsQuotation(wchar32 ch) {
return NUnicode::CharHasType(ch,
SHIFT(Po_QUOTE) | SHIFT(Ps_QUOTE) | SHIFT(Pe_QUOTE) | SHIFT(Pi_QUOTE) |
SHIFT(Pf_QUOTE) | SHIFT(Po_SINGLE_QUOTE) | SHIFT(Ps_SINGLE_QUOTE) |
SHIFT(Pe_SINGLE_QUOTE) | SHIFT(Pi_SINGLE_QUOTE) | SHIFT(Pf_SINGLE_QUOTE));
-}
+}
inline bool IsSingleQuotation(wchar32 ch) {
return NUnicode::CharHasType(ch,
@@ -209,100 +209,100 @@ inline bool IsSingleQuotation(wchar32 ch) {
inline bool IsTerminal(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Po_TERMINAL));
-}
+}
inline bool IsPairedPunct(wchar32 ch) {
return NUnicode::CharHasType(ch,
SHIFT(Ps_START) | SHIFT(Pe_END) | SHIFT(Ps_QUOTE) | SHIFT(Pe_QUOTE) |
SHIFT(Pi_QUOTE) | SHIFT(Pf_QUOTE) | SHIFT(Ps_SINGLE_QUOTE) |
SHIFT(Pe_SINGLE_QUOTE) | SHIFT(Pi_SINGLE_QUOTE) | SHIFT(Pf_SINGLE_QUOTE));
-}
+}
inline bool IsLeftPunct(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Ps_START) | SHIFT(Ps_QUOTE) | SHIFT(Ps_SINGLE_QUOTE));
-}
+}
inline bool IsRightPunct(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Pe_END) | SHIFT(Pe_QUOTE) | SHIFT(Pe_SINGLE_QUOTE));
-}
+}
inline bool IsCombining(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Mc_SPACING) | SHIFT(Mn_NONSPACING) | SHIFT(Me_ENCLOSING));
-}
+}
inline bool IsNonspacing(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Mn_NONSPACING) | SHIFT(Me_ENCLOSING));
-}
+}
inline bool IsAlphabetic(wchar32 ch) {
return NUnicode::CharHasType(ch,
SHIFT(Lu_UPPER) | SHIFT(Ll_LOWER) | SHIFT(Lt_TITLE) | SHIFT(Lm_EXTENDER) | SHIFT(Lm_LETTER) | SHIFT(Lo_OTHER) | SHIFT(Nl_LETTER));
-}
+}
inline bool IsIdeographic(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_IDEOGRAPH) | SHIFT(Nl_IDEOGRAPH));
-}
+}
inline bool IsKatakana(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_KATAKANA));
-}
+}
inline bool IsHiragana(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_HIRAGANA));
-}
+}
inline bool IsHangulLeading(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_LEADING));
-}
+}
inline bool IsHangulVowel(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_VOWEL));
-}
+}
inline bool IsHangulTrailing(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_TRAILING));
-}
+}
inline bool IsHexdigit(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & IS_ASCII_XDIGIT;
-}
+}
inline bool IsDecdigit(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Nd_DIGIT));
-}
+}
inline bool IsNumeric(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Nd_DIGIT) | SHIFT(Nl_LETTER) | SHIFT(Nl_IDEOGRAPH) | SHIFT(No_OTHER));
-}
+}
inline bool IsCurrency(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Sc_CURRENCY));
-}
+}
inline bool IsMath(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Sm_MATH));
-}
+}
inline bool IsSymbol(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Sm_MATH) | SHIFT(Sm_MINUS) | SHIFT(Sc_CURRENCY) | SHIFT(Sk_MODIFIER) | SHIFT(So_OTHER));
-}
+}
inline bool IsLowSurrogate(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cs_LOW));
-}
+}
inline bool IsHighSurrogate(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cs_HIGH));
-}
+}
inline bool IsNonbreak(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & IS_NONBREAK;
-}
+}
inline bool IsPrivate(wchar32 ch) {
return (NUnicode::NPrivate::CharInfo(ch) & IS_PRIVATE) && !NUnicode::CharHasType(ch, SHIFT(Cs_HIGH));
-}
+}
inline bool IsUnassigned(wchar32 ch) {
return (NUnicode::CharType(ch) == 0) && !(NUnicode::NPrivate::CharInfo(ch) & IS_PRIVATE);
-}
+}
inline bool IsPrivateHighSurrogate(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cs_HIGH)) && (NUnicode::NPrivate::CharInfo(ch) & IS_PRIVATE);
-}
+}
-// transformations
+// transformations
inline wchar32 ToLower(wchar32 ch) {
return static_cast<wchar32>(ch + NUnicode::NPrivate::CharProperty(ch).Lower);
-}
+}
inline wchar32 ToUpper(wchar32 ch) {
return static_cast<wchar32>(ch + NUnicode::NPrivate::CharProperty(ch).Upper);
-}
+}
inline wchar32 ToTitle(wchar32 ch) {
return static_cast<wchar32>(ch + NUnicode::NPrivate::CharProperty(ch).Title);
-}
+}
inline int ToDigit(wchar32 ch) {
ui32 i = NUnicode::NPrivate::CharInfo(ch);
return (i & IS_DIGIT) ? static_cast<int>(i >> SVAL_OFFSET) : -1;
-}
+}
// BIDI properties
diff --git a/util/datetime/base.h b/util/datetime/base.h
index 2034c2ca8c..5e902b8f63 100644
--- a/util/datetime/base.h
+++ b/util/datetime/base.h
@@ -44,18 +44,18 @@ class TDateTimeParseException: public yexception {
};
const int DATE_BUF_LEN = 4 + 2 + 2 + 1; // [YYYYMMDD*]
-
+
constexpr long seconds(const struct tm& theTm) {
return 60 * (60 * theTm.tm_hour + theTm.tm_min) + theTm.tm_sec;
-}
-
+}
+
void sprint_gm_date(char* buf, time_t when, long* sec = nullptr);
bool sscan_date(const char* date, struct tm& theTm);
-
+
const int DATE_8601_LEN = 21; // strlen("YYYY-MM-DDThh:mm:ssZ") = 20 + '\0'
size_t FormatDate8601(char* buf, size_t len, time_t when);
-
+
inline void sprint_date8601(char* buf, time_t when) {
buf[FormatDate8601(buf, 64, when)] = 0;
}
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index 432cc515ff..ab39fc7537 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -12,7 +12,7 @@
#include <util/system/yassert.h>
#include <contrib/libs/libc_compat/string.h>
-
+
#include <cctype>
#include <cstring>
#include <string>
diff --git a/util/generic/string.cpp b/util/generic/string.cpp
index b505b03a3f..3c655f1f66 100644
--- a/util/generic/string.cpp
+++ b/util/generic/string.cpp
@@ -1,5 +1,5 @@
#include "string.h"
-
+
#include <util/string/ascii.h>
#include <util/system/sanitizers.h>
#include <util/system/sys_alloc.h>
@@ -26,17 +26,17 @@ bool TBasicString<char, std::char_traits<char>>::to_lower(size_t pos, size_t n)
template <>
bool TBasicString<char, std::char_traits<char>>::to_upper(size_t pos, size_t n) {
return Transform([](size_t, char c) { return AsciiToUpper(c); }, pos, n);
-}
-
+}
+
template <>
bool TBasicString<char, std::char_traits<char>>::to_title(size_t pos, size_t n) {
if (n == 0) {
return false;
- }
+ }
bool changed = to_upper(pos, 1);
return to_lower(pos + 1, n - 1) || changed;
-}
-
+}
+
template <>
TUtf16String&
TBasicString<wchar16, std::char_traits<wchar16>>::AppendAscii(const ::TStringBuf& s) {
diff --git a/util/generic/string.h b/util/generic/string.h
index 685bd1febc..8cd8aa6917 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -19,7 +19,7 @@
#include "strbase.h"
#include "strbuf.h"
#include "string_hash.h"
-
+
#if defined(address_sanitizer_enabled) || defined(thread_sanitizer_enabled)
#include "hide_ptr.h"
#endif
@@ -306,7 +306,7 @@ public:
return ConstRef().c_str();
}
- // ~~~ STL compatible method to obtain data pointer ~~~
+ // ~~~ STL compatible method to obtain data pointer ~~~
iterator begin() {
return &*MutRef().begin();
}
@@ -314,7 +314,7 @@ public:
iterator vend() {
return &*MutRef().end();
}
-
+
reverse_iterator rbegin() {
return reverse_iterator(vend());
}
@@ -1092,7 +1092,7 @@ public:
return *this;
}
-
+
TBasicString& replace(size_t pos, size_t n, const TCharType* s, size_t len) Y_NOEXCEPT {
MutRef().replace(pos, n, s, len);
@@ -1116,7 +1116,7 @@ public:
return *this;
}
-
+
void swap(TBasicString& s) noexcept {
#ifdef TSTRING_IS_STD_STRING
std::swap(Storage_, s.Storage_);
diff --git a/util/memory/alloc.h b/util/memory/alloc.h
index c2f2a4cd72..d59575aef5 100644
--- a/util/memory/alloc.h
+++ b/util/memory/alloc.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <memory>
template <class Allocator, class T>
diff --git a/util/str_stl.h b/util/str_stl.h
index 10c574f118..f1e137181d 100644
--- a/util/str_stl.h
+++ b/util/str_stl.h
@@ -29,7 +29,7 @@ namespace std {
using is_transparent = void;
};
}
-
+
namespace NHashPrivate {
template <class T, bool needNumericHashing>
struct THashHelper {
@@ -78,8 +78,8 @@ struct hash<const char*>: ::NHashPrivate::TStringHash<char> {
template <>
struct THash<TStringBuf>: ::NHashPrivate::TStringHash<char> {
-};
-
+};
+
template <>
struct hash<TString>: ::NHashPrivate::TStringHash<char> {
};
diff --git a/util/stream/file.h b/util/stream/file.h
index df1ac6b390..c1cf4f591d 100644
--- a/util/stream/file.h
+++ b/util/stream/file.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "fwd.h"
#include "input.h"
#include "output.h"
diff --git a/util/string/util.h b/util/string/util.h
index ebee2e8664..0d77a5042b 100644
--- a/util/string/util.h
+++ b/util/string/util.h
@@ -1,5 +1,5 @@
#pragma once
-
+
//THIS FILE A COMPAT STUB HEADER
#include <cstring>
diff --git a/util/system/compat.cpp b/util/system/compat.cpp
index 5fe6332b82..18fbfa296a 100644
--- a/util/system/compat.cpp
+++ b/util/system/compat.cpp
@@ -8,7 +8,7 @@
#include <cstring>
#include <cstdarg>
#include <cstdlib>
-
+
#include <util/generic/string.h>
#ifdef _win_
diff --git a/util/system/compat.h b/util/system/compat.h
index 679f51084a..c53dbcca17 100644
--- a/util/system/compat.h
+++ b/util/system/compat.h
@@ -1,11 +1,11 @@
#pragma once
-
+
#include "defaults.h"
#include <cstdarg>
#include <csignal>
-
+
#if defined(_unix_)
#include <unistd.h>
#endif
@@ -14,10 +14,10 @@
#include <process.h>
#endif
-extern "C" {
+extern "C" {
#if defined(_win_)
using pid_t = int;
-
+
inline unsigned int alarm(unsigned int /*seconds*/) {
return 0; // no alarm is currently set :)
}
diff --git a/util/system/defaults.h b/util/system/defaults.h
index 300448e7d7..dcd7abea38 100644
--- a/util/system/defaults.h
+++ b/util/system/defaults.h
@@ -14,10 +14,10 @@
#include <new>
#endif
-// low and high parts of integers
+// low and high parts of integers
#if !defined(_win_)
#include <sys/param.h>
-#endif
+#endif
#if defined(BSD) || defined(_android_)
@@ -42,20 +42,20 @@
#else
#define _little_endian_
#endif
-
-// alignment
+
+// alignment
#if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_QUADS)
#define _must_align8_
-#endif
-
+#endif
+
#if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_LONGS)
#define _must_align4_
-#endif
-
+#endif
+
#if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_SHORTS)
#define _must_align2_
-#endif
-
+#endif
+
#if defined(__GNUC__)
#define alias_hack __attribute__((__may_alias__))
#endif
@@ -66,13 +66,13 @@
#include "types.h"
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#define PRAGMA(x) _Pragma(#x)
#define RCSID(idstr) PRAGMA(comment(exestr, idstr))
-#else
+#else
#define RCSID(idstr) static const char rcsid[] = idstr
-#endif
-
+#endif
+
#include "compiler.h"
#ifdef _win_
diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp
index fc125cc9bf..7454a4cb94 100644
--- a/util/system/filemap.cpp
+++ b/util/system/filemap.cpp
@@ -6,7 +6,7 @@
#include <util/generic/buffer.h>
#include <util/generic/yexception.h>
#include <util/generic/singleton.h>
-
+
#if defined(_win_)
#include "winint.h"
#elif defined(_unix_)
@@ -28,8 +28,8 @@
#endif
#else
#error todo
-#endif
-
+#endif
+
#include <util/generic/utility.h>
#include <util/system/sanitizers.h>
#include "filemap.h"
@@ -254,7 +254,7 @@ public:
result.Ptr = PtrStart_ ? static_cast<caddr_t>(PtrStart_) + base : nullptr;
}
#endif
-#endif
+#endif
if (result.Ptr != nullptr || size == 0) { // allow map of size 0
result.Size = size;
} else {
@@ -284,8 +284,8 @@ public:
}
#endif
}
-#endif
-
+#endif
+
void SetSequential() {
#if defined(_unix_)
if (!(Mode_ & oNotGreedy) && Length_) {
diff --git a/util/system/filemap.h b/util/system/filemap.h
index bbcabc4ec0..11be64bff4 100644
--- a/util/system/filemap.h
+++ b/util/system/filemap.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "file.h"
#include "align.h"
#include "yassert.h"
@@ -47,7 +47,7 @@ struct TMemoryMapCommon {
Reset();
}
};
-
+
enum EOpenModeFlag {
oRdOnly = 1,
oRdWr = 2,
@@ -105,7 +105,7 @@ private:
class TImpl;
TSimpleIntrusivePtr<TImpl> Impl_;
};
-
+
class TFileMap: public TMemoryMapCommon {
public:
TFileMap(const TMemoryMap& map) noexcept;
@@ -141,7 +141,7 @@ public:
inline i64 Length() const noexcept {
return Map_.Length();
}
-
+
inline bool IsOpen() const noexcept {
return Map_.IsOpen();
}
@@ -182,7 +182,7 @@ private:
TMemoryMap Map_;
TMapResult Region_;
};
-
+
template <class T>
class TFileMappedArray {
private:
@@ -325,7 +325,7 @@ private:
bool Shared_ = false;
#ifdef _win_
void* Mapping_ = nullptr;
-#endif
+#endif
};
template <class T>
diff --git a/util/system/maxlen.h b/util/system/maxlen.h
index a522914401..e1ff7f5008 100644
--- a/util/system/maxlen.h
+++ b/util/system/maxlen.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <cstdlib>
// http://support.microsoft.com/kb/208427
diff --git a/util/system/mutex.cpp b/util/system/mutex.cpp
index 9b36c272a5..4041402db9 100644
--- a/util/system/mutex.cpp
+++ b/util/system/mutex.cpp
@@ -7,14 +7,14 @@
#include "winint.h"
#else
#include <pthread.h>
-#endif
-
+#endif
+
class TMutex::TImpl {
public:
inline TImpl() {
#if defined(_win_)
InitializeCriticalSection(&Obj);
-#else
+#else
struct T {
pthread_mutexattr_t Attr;
@@ -43,25 +43,25 @@ public:
if (result != 0) {
ythrow yexception() << "mutex init failed(" << LastSystemErrorText(result) << ")";
}
-#endif
+#endif
}
-
+
inline ~TImpl() {
#if defined(_win_)
DeleteCriticalSection(&Obj);
-#else
+#else
int result = pthread_mutex_destroy(&Obj);
Y_VERIFY(result == 0, "mutex destroy failure (%s)", LastSystemErrorText(result));
-#endif
+#endif
}
inline void Acquire() noexcept {
#if defined(_win_)
EnterCriticalSection(&Obj);
-#else
+#else
int result = pthread_mutex_lock(&Obj);
Y_VERIFY(result == 0, "mutex lock failure (%s)", LastSystemErrorText(result));
-#endif
+#endif
}
#if defined(_win_)
@@ -90,22 +90,22 @@ public:
inline bool TryAcquire() noexcept {
#if defined(_win_)
return TryEnterCriticalSectionInt(&Obj);
-#else
+#else
int result = pthread_mutex_trylock(&Obj);
if (result == 0 || result == EBUSY) {
return result == 0;
}
Y_FAIL("mutex trylock failure (%s)", LastSystemErrorText(result));
-#endif
+#endif
}
inline void Release() noexcept {
#if defined(_win_)
LeaveCriticalSection(&Obj);
-#else
+#else
int result = pthread_mutex_unlock(&Obj);
Y_VERIFY(result == 0, "mutex unlock failure (%s)", LastSystemErrorText(result));
-#endif
+#endif
}
inline void* Handle() const noexcept {
@@ -123,8 +123,8 @@ private:
TMutex::TMutex()
: Impl_(new TImpl())
{
-}
-
+}
+
TMutex::TMutex(TMutex&&) = default;
TMutex::~TMutex() = default;
diff --git a/util/system/mutex.h b/util/system/mutex.h
index 4d11fc9c7a..032630d134 100644
--- a/util/system/mutex.h
+++ b/util/system/mutex.h
@@ -1,16 +1,16 @@
#pragma once
-
+
#include "guard.h"
#include "defaults.h"
#include <util/generic/ptr.h>
#include <util/generic/noncopyable.h>
-
+
class TFakeMutex: public TNonCopyable {
public:
inline void Acquire() noexcept {
}
-
+
inline bool TryAcquire() noexcept {
return true;
}
@@ -32,7 +32,7 @@ public:
~TFakeMutex() = default;
};
-
+
class TMutex {
public:
TMutex();
diff --git a/util/system/sys_alloc.h b/util/system/sys_alloc.h
index 3698960e8a..4221a28f8c 100644
--- a/util/system/sys_alloc.h
+++ b/util/system/sys_alloc.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <util/system/compiler.h>
#include <cstdlib>
diff --git a/util/system/tls.h b/util/system/tls.h
index 17d58e3a0c..3c4f56dbeb 100644
--- a/util/system/tls.h
+++ b/util/system/tls.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "defaults.h"
#include <util/generic/ptr.h>
@@ -176,7 +176,7 @@ namespace NTls {
}
};
- template <class T>
+ template <class T>
class TValue: public TMoveOnly {
class TConstructor {
public:
@@ -227,12 +227,12 @@ namespace NTls {
: Constructor_(new TCopyConstructor<T1>(value))
, Key_(Dtor)
{
- }
+ }
template <class T1>
inline T& operator=(const T1& val) {
return Get() = val;
- }
+ }
inline operator const T&() const {
return Get();
@@ -275,7 +275,7 @@ namespace NTls {
}
return val;
- }
+ }
private:
static void Dtor(void* ptr) {
@@ -283,12 +283,12 @@ namespace NTls {
((T*)ptr)->~T();
::NPrivate::FillWithTrash(ptr, sizeof(T));
- }
+ }
private:
THolder<TConstructor> Constructor_;
TKey Key_;
- };
+ };
}
template <class T>
diff --git a/util/system/yassert.h b/util/system/yassert.h
index 8d54977cc9..529823440c 100644
--- a/util/system/yassert.h
+++ b/util/system/yassert.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "defaults.h"
#include "src_root.h"
#include "backtrace.h"
@@ -21,7 +21,7 @@
#endif
#include <cassert>
#endif
-
+
#if !defined(_MSC_VER)
#if defined(__has_builtin) && __has_builtin(__debugbreak)
// Do nothing, use __debugbreak builtin
diff --git a/util/thread/pool.h b/util/thread/pool.h
index d7d9202cd8..d1ea3a67cb 100644
--- a/util/thread/pool.h
+++ b/util/thread/pool.h
@@ -9,7 +9,7 @@
#include <util/generic/ptr.h>
#include <util/generic/noncopyable.h>
#include <functional>
-
+
class TDuration;
struct IObjectInQueue {
@@ -25,8 +25,8 @@ struct IObjectInQueue {
* parameter.
*/
virtual void Process(void* threadSpecificResource) = 0;
-};
-
+};
+
/**
* Mighty class to add 'Pool' method to derived classes.
* Useful only for creators of new queue classes.