diff options
| author | prime <[email protected]> | 2022-02-10 16:46:00 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:00 +0300 | 
| commit | 3695a7cd42b74a4987d8d5a8f2e2443556998943 (patch) | |
| tree | ee79ee9294a61ee00e647684b3700d0a87e102a3 /library/cpp | |
| parent | 4d8b546b89b5afc08cf3667e176271c7ba935f33 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
30 files changed, 205 insertions, 205 deletions
diff --git a/library/cpp/malloc/tcmalloc/ya.make b/library/cpp/malloc/tcmalloc/ya.make index 21372ff9e24..4eb86ecb0dc 100644 --- a/library/cpp/malloc/tcmalloc/ya.make +++ b/library/cpp/malloc/tcmalloc/ya.make @@ -6,7 +6,7 @@ OWNER(ayles)  PEERDIR(      library/cpp/malloc/api -    contrib/libs/tcmalloc/malloc_extension +    contrib/libs/tcmalloc/malloc_extension   )  SRCS(      malloc-info.cpp diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp index 87c832d642b..3f18e42d6ef 100644 --- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp +++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp @@ -89,25 +89,25 @@ void TBufferedEncoderBase::OnLabel(TStringBuf name, TStringBuf value) {      labels->emplace_back(LabelNamesPool_.PutIfAbsent(name), LabelValuesPool_.PutIfAbsent(value));  } -void TBufferedEncoderBase::OnLabel(ui32 name, ui32 value) { -    TPooledLabels* labels; -    if (State_ == TEncoderState::EState::METRIC_LABELS) { -        labels = &Metrics_.back().Labels; -    } else if (State_ == TEncoderState::EState::COMMON_LABELS) { -        labels = &CommonLabels_; -    } else { -        State_.ThrowInvalid("expected LABELS or COMMON_LABELS"); -    } - -    labels->emplace_back(LabelNamesPool_.GetByIndex(name), LabelValuesPool_.GetByIndex(value)); -} - +void TBufferedEncoderBase::OnLabel(ui32 name, ui32 value) {  +    TPooledLabels* labels;  +    if (State_ == TEncoderState::EState::METRIC_LABELS) {  +        labels = &Metrics_.back().Labels;  +    } else if (State_ == TEncoderState::EState::COMMON_LABELS) {  +        labels = &CommonLabels_;  +    } else {  +        State_.ThrowInvalid("expected LABELS or COMMON_LABELS");  +    }  +  +    labels->emplace_back(LabelNamesPool_.GetByIndex(name), LabelValuesPool_.GetByIndex(value));  +}  +   std::pair<ui32, ui32> TBufferedEncoderBase::PrepareLabel(TStringBuf name, TStringBuf value) { -    auto nameLabel = LabelNamesPool_.PutIfAbsent(name); -    auto valueLabel = LabelValuesPool_.PutIfAbsent(value); -    return std::make_pair(nameLabel->Index, valueLabel->Index); -} - +    auto nameLabel = LabelNamesPool_.PutIfAbsent(name);  +    auto valueLabel = LabelValuesPool_.PutIfAbsent(value);  +    return std::make_pair(nameLabel->Index, valueLabel->Index);  +}  +   void TBufferedEncoderBase::OnDouble(TInstant time, double value) {      State_.Expect(TEncoderState::EState::METRIC);      TMetric& metric = Metrics_.back(); diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h index fe3714e58f0..165d92203ef 100644 --- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h +++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h @@ -26,7 +26,7 @@ public:      void OnLabelsBegin() override;      void OnLabelsEnd() override;      void OnLabel(TStringBuf name, TStringBuf value) override; -    void OnLabel(ui32 name, ui32 value) override; +    void OnLabel(ui32 name, ui32 value) override;       std::pair<ui32, ui32> PrepareLabel(TStringBuf name, TStringBuf value) override;      void OnDouble(TInstant time, double value) override; diff --git a/library/cpp/monlib/encode/buffered/string_pool.cpp b/library/cpp/monlib/encode/buffered/string_pool.cpp index b4c7988ba33..d819e11ae72 100644 --- a/library/cpp/monlib/encode/buffered/string_pool.cpp +++ b/library/cpp/monlib/encode/buffered/string_pool.cpp @@ -10,8 +10,8 @@ namespace NMonitoring {          auto [it, isInserted] = StrMap_.try_emplace(str, Max<ui32>(), 0);          if (isInserted) {              BytesSize_ += str.size(); -            it->second.Index = StrVector_.size(); -            StrVector_.emplace_back(it->first, &it->second); +            it->second.Index = StrVector_.size();  +            StrVector_.emplace_back(it->first, &it->second);           }          TValue* value = &it->second; @@ -19,10 +19,10 @@ namespace NMonitoring {          return value;      } -    const TStringPoolBuilder::TValue* TStringPoolBuilder::GetByIndex(ui32 index) const { -        return StrVector_.at(index).second; -    } - +    const TStringPoolBuilder::TValue* TStringPoolBuilder::GetByIndex(ui32 index) const {  +        return StrVector_.at(index).second;  +    }  +       TStringPoolBuilder& TStringPoolBuilder::Build() {          if (RequiresSorting_) {              // sort in reversed order @@ -30,10 +30,10 @@ namespace NMonitoring {                  return a.second->Frequency > b.second->Frequency;              }); -            ui32 i = 0; -            for (auto& value : StrVector_) { -                value.second->Index = i++; -            } +            ui32 i = 0;  +            for (auto& value : StrVector_) {  +                value.second->Index = i++;  +            }           }          IsBuilt_ = true; diff --git a/library/cpp/monlib/encode/buffered/string_pool.h b/library/cpp/monlib/encode/buffered/string_pool.h index 00e5644608a..e216cff3886 100644 --- a/library/cpp/monlib/encode/buffered/string_pool.h +++ b/library/cpp/monlib/encode/buffered/string_pool.h @@ -22,7 +22,7 @@ namespace NMonitoring {      public:          const TValue* PutIfAbsent(TStringBuf str); -        const TValue* GetByIndex(ui32 index) const; +        const TValue* GetByIndex(ui32 index) const;           /// Determines whether pool must be sorted by value frequencies          TStringPoolBuilder& SetSorted(bool sorted) { diff --git a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp index 9fc3421d0bb..21839ccb470 100644 --- a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp +++ b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp @@ -16,10 +16,10 @@ Y_UNIT_TEST_SUITE(TStringPoolTest) {          UNIT_ASSERT(h2 == h3);          UNIT_ASSERT_VALUES_EQUAL(h1->Frequency, 1); -        UNIT_ASSERT_VALUES_EQUAL(h1->Index, 0); +        UNIT_ASSERT_VALUES_EQUAL(h1->Index, 0);           UNIT_ASSERT_VALUES_EQUAL(h2->Frequency, 2); -        UNIT_ASSERT_VALUES_EQUAL(h2->Index, 1); +        UNIT_ASSERT_VALUES_EQUAL(h2->Index, 1);           UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 6);          UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 2); @@ -49,8 +49,8 @@ Y_UNIT_TEST_SUITE(TStringPoolTest) {      Y_UNIT_TEST(ForEach) {          TStringPoolBuilder strPool; -        strPool.SetSorted(true); - +        strPool.SetSorted(true);  +           strPool.PutIfAbsent("one");          strPool.PutIfAbsent("two");          strPool.PutIfAbsent("two"); diff --git a/library/cpp/monlib/encode/json/json_encoder.cpp b/library/cpp/monlib/encode/json/json_encoder.cpp index 20d2bb6283f..e376cbb5645 100644 --- a/library/cpp/monlib/encode/json/json_encoder.cpp +++ b/library/cpp/monlib/encode/json/json_encoder.cpp @@ -440,11 +440,11 @@ namespace NMonitoring {                  EmptyLabels_ = false;              } -            void OnLabel(ui32 name, ui32 value) override { -                TBufferedEncoderBase::OnLabel(name, value); -                EmptyLabels_ = false; -            } - +            void OnLabel(ui32 name, ui32 value) override {  +                TBufferedEncoderBase::OnLabel(name, value);  +                EmptyLabels_ = false;  +            }  +               void OnLabelsEnd() override {                  TBufferedEncoderBase::OnLabelsEnd();                  Y_ENSURE(!EmptyLabels_, "Labels cannot be empty"); diff --git a/library/cpp/monlib/encode/json/json_ut.cpp b/library/cpp/monlib/encode/json/json_ut.cpp index 09e79092890..281c114a235 100644 --- a/library/cpp/monlib/encode/json/json_ut.cpp +++ b/library/cpp/monlib/encode/json/json_ut.cpp @@ -225,14 +225,14 @@ Y_UNIT_TEST_SUITE(TJsonTest) {              e->Close();              json += "\n"; -            auto parseJson = [] (auto buf) { -                NJson::TJsonValue value; -                NJson::ReadJsonTree(buf, &value, true); -                return value; -            }; - +            auto parseJson = [] (auto buf) {  +                NJson::TJsonValue value;  +                NJson::ReadJsonTree(buf, &value, true);  +                return value;  +            };  +               const auto expectedJson = NResource::Find(expectedResourceKey); -            UNIT_ASSERT_EQUAL(parseJson(json), parseJson(expectedJson)); +            UNIT_ASSERT_EQUAL(parseJson(json), parseJson(expectedJson));           };          check(false, false, "/expected.json"); diff --git a/library/cpp/monlib/encode/json/ut/expected_buffered.json b/library/cpp/monlib/encode/json/ut/expected_buffered.json index 9a6a1d6201d..0441766a68e 100644 --- a/library/cpp/monlib/encode/json/ut/expected_buffered.json +++ b/library/cpp/monlib/encode/json/ut/expected_buffered.json @@ -10,8 +10,8 @@          "kind":"COUNTER",          "labels":            { -            "labels":"l1", -            "metric":"single" +            "labels":"l1",  +            "metric":"single"             },          "ts":1509843723,          "value":17 @@ -20,8 +20,8 @@          "kind":"RATE",          "labels":            { -            "labels":"l2", -            "metric":"single" +            "labels":"l2",  +            "metric":"single"             },          "ts":1509843723,          "value":17 @@ -30,8 +30,8 @@          "kind":"GAUGE",          "labels":            { -            "labels":"l3", -            "metric":"single" +            "labels":"l3",  +            "metric":"single"             },          "ts":1509843723,          "value":3.14 @@ -40,8 +40,8 @@          "kind":"IGAUGE",          "labels":            { -            "labels":"l4", -            "metric":"single_igauge" +            "labels":"l4",  +            "metric":"single_igauge"             },          "ts":1509843723,          "value":42 @@ -50,8 +50,8 @@          "kind":"GAUGE",          "labels":            { -            "labels":"l5", -            "metric":"multiple" +            "labels":"l5",  +            "metric":"multiple"             },          "timeseries":            [ @@ -73,8 +73,8 @@          "kind":"COUNTER",          "labels":            { -            "labels":"l6", -            "metric":"multiple" +            "labels":"l6",  +            "metric":"multiple"             },          "timeseries":            [ diff --git a/library/cpp/monlib/encode/spack/spack_v1_ut.cpp b/library/cpp/monlib/encode/spack/spack_v1_ut.cpp index fe778eb7e02..7802f7c5e9c 100644 --- a/library/cpp/monlib/encode/spack/spack_v1_ut.cpp +++ b/library/cpp/monlib/encode/spack/spack_v1_ut.cpp @@ -78,18 +78,18 @@ Y_UNIT_TEST_SUITE(TSpackTest) {      ui8 expectedStringPools[] = {          0x6e, 0x61, 0x6d, 0x65, 0x00,                   // "name\0"          0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x00, // "project\0" -        0x73, 0x6f, 0x6c, 0x6f, 0x6d, 0x6f, 0x6e, 0x00, // "solomon\0" -        0x71, 0x31, 0x00,                               // "q1\0" -        0x71, 0x32, 0x00,                               // "q2\0" -        0x71, 0x33, 0x00,                               // "q3\0" -        0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x00,       // "answer\0" +        0x73, 0x6f, 0x6c, 0x6f, 0x6d, 0x6f, 0x6e, 0x00, // "solomon\0"  +        0x71, 0x31, 0x00,                               // "q1\0"  +        0x71, 0x32, 0x00,                               // "q2\0"  +        0x71, 0x33, 0x00,                               // "q3\0"  +        0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x00,       // "answer\0"           0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, // "responseTimeMillis\0"          0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x6c, 0x6c,          0x69, 0x73, 0x00,          0x62, 0x79, 0x74, 0x65, 0x73, 0x00,             // "bytes\0" -        0x74, 0x65, 0x6D, 0x70, 0x65, 0x72, 0x61, 0x74, // "temperature\0" -        0x75, 0x72, 0x65, 0x00, -        0x6d, 0x73, 0x00,                               // "ms\0" +        0x74, 0x65, 0x6D, 0x70, 0x65, 0x72, 0x61, 0x74, // "temperature\0"  +        0x75, 0x72, 0x65, 0x00,  +        0x6d, 0x73, 0x00,                               // "ms\0"       };      ui8 expectedCommonTime[] = { @@ -99,7 +99,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {      ui8 expectedCommonLabels[] = {          0x01, // common labels count                     (varint)          0x01, // label name index                        (varint) -        0x00, // label value index                       (varint) +        0x00, // label value index                       (varint)       };      ui8 expectedMetric1[] = { @@ -107,7 +107,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {          0x00, // flags                                   (fixed ui8)          0x01, // metric labels count                     (varint)          0x00, // label name index                        (varint) -        0x01, // label value index                       (varint) +        0x01, // label value index                       (varint)       };      ui8 expectedMetric2[] = { @@ -115,7 +115,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {          0x00,                                           // flags                                   (fixed ui8)          0x01,                                           // metric labels count                     (varint)          0x00,                                           // label name index                        (varint) -        0x02,                                           // label value index                       (varint) +        0x02,                                           // label value index                       (varint)           0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // value (fixed ui64)      }; @@ -147,7 +147,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {          0x00,                                           // flags                                   (fixed ui8)          0x01,                                           // metric labels count                     (varint)          0x00,                                           // label name index                        (varint) -        0x05,                                           // label value index                       (varint) +        0x05,                                           // label value index                       (varint)           0x0b, 0x63, 0xfe, 0x59,                         // time in seconds                         (fixed ui32)          0x06,                                           // histogram buckets count                 (varint)          0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // histogram bucket bounds                 (array of fixed ui64) @@ -169,7 +169,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {          0x00,                                           // flags                                   (fixed ui8)          0x01,                                           // metric labels count                     (varint)          0x00,                                           // label name index                        (varint) -        0x05,                                           // label value index                       (varint) +        0x05,                                           // label value index                       (varint)           0x0b, 0x63, 0xfe, 0x59,                         // time in seconds                         (fixed ui32)          0x06,                                           // histogram buckets count                 (varint)          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, // histogram bucket bounds                 (array of doubles) @@ -201,7 +201,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {          0x00,                                           // flags                                   (fixed ui8)          0x01,                                           // metric labels count                     (varint)          0x00,                                           // label name index                        (varint) -        0x07,                                           // label value index                       (varint) +        0x07,                                           // label value index                       (varint)           0x0b, 0x63, 0xfe, 0x59,                         // time in seconds                         (fixed ui32)          0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // count                                   (fixed ui64)          0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x24, 0x40, // sum                                     (fixed double) @@ -755,7 +755,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {                      e->OnMetricBegin(EMetricType::COUNTER);                      {                          e->OnLabelsBegin(); -                        e->OnLabel("project", "solomon"); +                        e->OnLabel("project", "solomon");                           e->OnLabel("s", "temperature");                          e->OnLabelsEnd();                      } diff --git a/library/cpp/monlib/metrics/metric_consumer.cpp b/library/cpp/monlib/metrics/metric_consumer.cpp index 121ee368f02..c2155f4b5bf 100644 --- a/library/cpp/monlib/metrics/metric_consumer.cpp +++ b/library/cpp/monlib/metrics/metric_consumer.cpp @@ -1,15 +1,15 @@ -#include "metric_consumer.h" - -#include <util/system/yassert.h> - -namespace NMonitoring { -    void IMetricConsumer::OnLabel(ui32 name, ui32 value) { -        Y_UNUSED(name, value); -        Y_ENSURE(false, "Not implemented"); -    } - +#include "metric_consumer.h"  +  +#include <util/system/yassert.h>  +  +namespace NMonitoring {  +    void IMetricConsumer::OnLabel(ui32 name, ui32 value) {  +        Y_UNUSED(name, value);  +        Y_ENSURE(false, "Not implemented");  +    }  +       std::pair<ui32, ui32> IMetricConsumer::PrepareLabel(TStringBuf name, TStringBuf value) { -        Y_UNUSED(name, value); -        Y_ENSURE(false, "Not implemented"); -    } -} +        Y_UNUSED(name, value);  +        Y_ENSURE(false, "Not implemented");  +    }  +}  diff --git a/library/cpp/monlib/metrics/metric_consumer.h b/library/cpp/monlib/metrics/metric_consumer.h index f7a727585ad..74352103faf 100644 --- a/library/cpp/monlib/metrics/metric_consumer.h +++ b/library/cpp/monlib/metrics/metric_consumer.h @@ -23,7 +23,7 @@ namespace NMonitoring {          virtual void OnLabelsBegin() = 0;          virtual void OnLabelsEnd() = 0;          virtual void OnLabel(TStringBuf name, TStringBuf value) = 0; -        virtual void OnLabel(ui32 name, ui32 value); +        virtual void OnLabel(ui32 name, ui32 value);           virtual std::pair<ui32, ui32> PrepareLabel(TStringBuf name, TStringBuf value);          virtual void OnDouble(TInstant time, double value) = 0; diff --git a/library/cpp/monlib/metrics/ya.make b/library/cpp/monlib/metrics/ya.make index 0e1fa143f9f..a2ecf50df01 100644 --- a/library/cpp/monlib/metrics/ya.make +++ b/library/cpp/monlib/metrics/ya.make @@ -17,7 +17,7 @@ SRCS(      log_histogram_snapshot.cpp      labels.cpp      metric_registry.cpp -    metric_consumer.cpp +    metric_consumer.cpp       metric_type.cpp      metric_value.cpp      summary_snapshot.cpp diff --git a/library/cpp/svnversion/test/main.cpp b/library/cpp/svnversion/test/main.cpp index 3c8209047ff..fc1eeef11cb 100644 --- a/library/cpp/svnversion/test/main.cpp +++ b/library/cpp/svnversion/test/main.cpp @@ -24,7 +24,7 @@ int main() {      Cout << "GetBranch(): " << GetBranch() << Endl;      Cout << "GetTag(): " << GetTag() << Endl;      Cout << "GetArcadiaPatchNumber(): " << GetArcadiaPatchNumber() << Endl; -    Cout << "GetVCSDirty(): " << GetVCSDirty() << Endl; +    Cout << "GetVCSDirty(): " << GetVCSDirty() << Endl;       return 0;  } diff --git a/library/cpp/ya.make b/library/cpp/ya.make index 8c1193b0077..032a9b37e36 100644 --- a/library/cpp/ya.make +++ b/library/cpp/ya.make @@ -427,7 +427,7 @@ IF (OS_LINUX)          balloc_market/test          balloc_market/aba_agri_test          ytalloc -        rseq +        rseq       )  ENDIF() diff --git a/library/cpp/yt/memory/blob.cpp b/library/cpp/yt/memory/blob.cpp index 86000b033bc..5b3be740bf6 100644 --- a/library/cpp/yt/memory/blob.cpp +++ b/library/cpp/yt/memory/blob.cpp @@ -3,17 +3,17 @@  #include <library/cpp/ytalloc/api/ytalloc.h> -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - +namespace NYT {  +  +////////////////////////////////////////////////////////////////////////////////  +   static constexpr size_t InitialBlobCapacity = 16;  static constexpr double BlobCapacityMultiplier = 1.5; -TBlob::TBlob( -    TRefCountedTypeCookie tagCookie, -    size_t size, -    bool initiailizeStorage, +TBlob::TBlob(  +    TRefCountedTypeCookie tagCookie,  +    size_t size,  +    bool initiailizeStorage,       bool pageAligned)      : PageAligned_(pageAligned)  { @@ -29,8 +29,8 @@ TBlob::TBlob(      }  } -TBlob::TBlob( -    TRefCountedTypeCookie tagCookie, +TBlob::TBlob(  +    TRefCountedTypeCookie tagCookie,       TRef data,      bool pageAligned)      : PageAligned_(pageAligned) @@ -97,8 +97,8 @@ void TBlob::Resize(size_t newSize, bool initializeStorage /*= true*/)  TBlob& TBlob::operator = (const TBlob& rhs)  {      if (this != &rhs) { -        this->~TBlob(); -        new(this) TBlob(rhs); +        this->~TBlob();  +        new(this) TBlob(rhs);       }      return *this;  } @@ -106,8 +106,8 @@ TBlob& TBlob::operator = (const TBlob& rhs)  TBlob& TBlob::operator = (TBlob&& rhs) noexcept  {      if (this != &rhs) { -        this->~TBlob(); -        new(this) TBlob(std::move(rhs)); +        this->~TBlob();  +        new(this) TBlob(std::move(rhs));       }      return *this;  } diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h index 3dead7db1d7..c2500839578 100644 --- a/library/cpp/yt/memory/intrusive_ptr.h +++ b/library/cpp/yt/memory/intrusive_ptr.h @@ -6,7 +6,7 @@  #include <util/generic/utility.h>  #include <utility> -#include <type_traits> +#include <type_traits>   namespace NYT { @@ -21,7 +21,7 @@ public:      constexpr TIntrusivePtr() noexcept      { } -    constexpr TIntrusivePtr(std::nullptr_t) noexcept +    constexpr TIntrusivePtr(std::nullptr_t) noexcept       { }      //! Constructor from an unqualified reference. @@ -50,7 +50,7 @@ public:      }      //! Copy constructor with an upcast. -    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> +    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>       TIntrusivePtr(const TIntrusivePtr<U>& other) noexcept          : T_(other.Get())      { @@ -70,7 +70,7 @@ public:      }      //! Move constructor with an upcast. -    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> +    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>       TIntrusivePtr(TIntrusivePtr<U>&& other) noexcept          : T_(other.Get())      { @@ -100,7 +100,7 @@ public:      TIntrusivePtr& operator=(const TIntrusivePtr<U>& other) noexcept      {          static_assert( -            std::is_convertible_v<U*, T*>, +            std::is_convertible_v<U*, T*>,               "U* must be convertible to T*");          static_assert(              std::is_base_of_v<TRefCountedBase, T>, @@ -121,7 +121,7 @@ public:      TIntrusivePtr& operator=(TIntrusivePtr<U>&& other) noexcept      {          static_assert( -            std::is_convertible_v<U*, T*>, +            std::is_convertible_v<U*, T*>,               "U* must be convertible to T*");          static_assert(              std::is_base_of_v<TRefCountedBase, T>, @@ -271,7 +271,7 @@ template <class T, class U>  bool operator==(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs)  {      static_assert( -        std::is_convertible_v<U*, T*>, +        std::is_convertible_v<U*, T*>,           "U* must be convertible to T*");      return lhs.Get() == rhs.Get();  } @@ -280,7 +280,7 @@ template <class T, class U>  bool operator!=(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs)  {      static_assert( -        std::is_convertible_v<U*, T*>, +        std::is_convertible_v<U*, T*>,           "U* must be convertible to T*");      return lhs.Get() != rhs.Get();  } @@ -289,7 +289,7 @@ template <class T, class U>  bool operator==(const TIntrusivePtr<T>& lhs, U* rhs)  {      static_assert( -        std::is_convertible_v<U*, T*>, +        std::is_convertible_v<U*, T*>,           "U* must be convertible to T*");      return lhs.Get() == rhs;  } @@ -298,7 +298,7 @@ template <class T, class U>  bool operator!=(const TIntrusivePtr<T>& lhs, U* rhs)  {      static_assert( -        std::is_convertible_v<U*, T*>, +        std::is_convertible_v<U*, T*>,           "U* must be convertible to T*");      return lhs.Get() != rhs;  } @@ -307,7 +307,7 @@ template <class T, class U>  bool operator==(T* lhs, const TIntrusivePtr<U>& rhs)  {      static_assert( -        std::is_convertible_v<U*, T*>, +        std::is_convertible_v<U*, T*>,           "U* must be convertible to T*");      return lhs == rhs.Get();  } @@ -316,7 +316,7 @@ template <class T, class U>  bool operator!=(T* lhs, const TIntrusivePtr<U>& rhs)  {      static_assert( -        std::is_convertible_v<U*, T*>, +        std::is_convertible_v<U*, T*>,           "U* must be convertible to T*");      return lhs != rhs.Get();  } @@ -351,7 +351,7 @@ bool operator!=(const TIntrusivePtr<T>& lhs, std::nullptr_t)  //! A hasher for TIntrusivePtr.  template <class T> -struct THash<NYT::TIntrusivePtr<T>> +struct THash<NYT::TIntrusivePtr<T>>   {      Y_FORCE_INLINE size_t operator () (const NYT::TIntrusivePtr<T>& ptr) const      { diff --git a/library/cpp/yt/memory/weak_ptr.h b/library/cpp/yt/memory/weak_ptr.h index 25a242bb8a5..b4650930a55 100644 --- a/library/cpp/yt/memory/weak_ptr.h +++ b/library/cpp/yt/memory/weak_ptr.h @@ -43,7 +43,7 @@ public:      { }      //! Constructor from a strong reference with an upcast. -    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> +    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>       TWeakPtr(const TIntrusivePtr<U>& ptr) noexcept          : TWeakPtr(ptr.Get())      { @@ -58,7 +58,7 @@ public:      { }      //! Copy constructor with an upcast. -    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> +    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>       TWeakPtr(const TWeakPtr<U>& other) noexcept          : TWeakPtr(other.Lock())      { @@ -74,7 +74,7 @@ public:      }      //! Move constructor with an upcast. -    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> +    template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>       TWeakPtr(TWeakPtr<U>&& other) noexcept      {          static_assert( @@ -103,7 +103,7 @@ public:      TWeakPtr& operator=(const TIntrusivePtr<U>& ptr) noexcept      {          static_assert( -            std::is_convertible_v<U*, T*>, +            std::is_convertible_v<U*, T*>,               "U* must be convertible to T*");          TWeakPtr(ptr).Swap(*this);          return *this; @@ -121,7 +121,7 @@ public:      TWeakPtr& operator=(const TWeakPtr<U>& other) noexcept      {          static_assert( -            std::is_convertible_v<U*, T*>, +            std::is_convertible_v<U*, T*>,               "U* must be convertible to T*");          TWeakPtr(other).Swap(*this);          return *this; @@ -139,7 +139,7 @@ public:      TWeakPtr& operator=(TWeakPtr<U>&& other) noexcept      {          static_assert( -            std::is_convertible_v<U*, T*>, +            std::is_convertible_v<U*, T*>,               "U* must be convertible to T*");          TWeakPtr(std::move(other)).Swap(*this);          return *this; @@ -162,7 +162,7 @@ public:      void Reset(const TIntrusivePtr<U>& ptr) // noexcept      {          static_assert( -            std::is_convertible_v<U*, T*>, +            std::is_convertible_v<U*, T*>,               "U* must be convertible to T*");          TWeakPtr(ptr).Swap(*this);      } @@ -210,7 +210,7 @@ private:      template <class U>      friend class TWeakPtr;      template <class U> -    friend struct ::THash; +    friend struct ::THash;       T* T_ = nullptr;  #if defined(_tsan_enabled_) @@ -284,7 +284,7 @@ template <class T, class U>  bool operator==(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs)  {      static_assert( -        std::is_convertible_v<U*, T*>, +        std::is_convertible_v<U*, T*>,           "U* must be convertible to T*");      return lhs.Lock().Get() == rhs.Lock().Get();  } @@ -293,7 +293,7 @@ template <class T, class U>  bool operator!=(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs)  {      static_assert( -        std::is_convertible_v<U*, T*>, +        std::is_convertible_v<U*, T*>,           "U* must be convertible to T*");      return lhs.Lock().Get() != rhs.Lock().Get();  } @@ -305,7 +305,7 @@ bool operator!=(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs)  //! A hasher for TWeakPtr.  template <class T> -struct THash<NYT::TWeakPtr<T>> +struct THash<NYT::TWeakPtr<T>>   {      size_t operator () (const NYT::TWeakPtr<T>& ptr) const      { diff --git a/library/cpp/yt/misc/guid-inl.h b/library/cpp/yt/misc/guid-inl.h index 2d94b5701b0..472457eb6dd 100644 --- a/library/cpp/yt/misc/guid-inl.h +++ b/library/cpp/yt/misc/guid-inl.h @@ -66,7 +66,7 @@ Y_FORCE_INLINE bool operator < (TGuid lhs, TGuid rhs)  } // namespace NYT -Y_FORCE_INLINE size_t THash<NYT::TGuid>::operator()(const NYT::TGuid& guid) const +Y_FORCE_INLINE size_t THash<NYT::TGuid>::operator()(const NYT::TGuid& guid) const   {      const size_t p = 1000000009; // prime number      return guid.Parts32[0] + diff --git a/library/cpp/yt/misc/guid.cpp b/library/cpp/yt/misc/guid.cpp index 882787d7a2b..501b9630cb9 100644 --- a/library/cpp/yt/misc/guid.cpp +++ b/library/cpp/yt/misc/guid.cpp @@ -115,28 +115,28 @@ bool TGuid::FromStringHex32(TStringBuf str, TGuid* result)          return false;      } -    bool ok = true; -    int i = 0; -    auto parseChar = [&] { -        const char c = str[i++]; -        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 { -            ok = false; -        } -        return digit; -    }; - -    for (size_t j = 0; j < 16; ++j) { -        result->ReversedParts8[15 - j] = parseChar() * 16 + parseChar(); +    bool ok = true;  +    int i = 0;  +    auto parseChar = [&] {  +        const char c = str[i++];  +        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 {  +            ok = false;  +        }  +        return digit;  +    };  + +    for (size_t j = 0; j < 16; ++j) {  +        result->ReversedParts8[15 - j] = parseChar() * 16 + parseChar();       } -    return ok; +    return ok;   }  char* WriteGuidToBuffer(char* ptr, TGuid value) diff --git a/library/cpp/yt/misc/guid.h b/library/cpp/yt/misc/guid.h index ec4ba3526af..e202e1e679f 100644 --- a/library/cpp/yt/misc/guid.h +++ b/library/cpp/yt/misc/guid.h @@ -9,39 +9,39 @@ namespace NYT {  //////////////////////////////////////////////////////////////////////////////// -//! TGuid is 16-byte value that might be interpreted as four little-endian 32-bit integers or two 64-bit little-endian integers. -/*! - *    *-------------------------*-------------------------* - *    |       Parts64[0]        |       Parts64[1]        | - *    *------------*------------*------------*------------* - *    | Parts32[0] | Parts32[1] | Parts32[2] | Parts32[3] | - *    *------------*------------*------------*------------* - *    | 15..............................................0 | - *    *---------------------------------------------------* - * - *  Note, that bytes are kept in memory in reverse order. - * - *  Canonical text representation of guid consists of four base-16 numbers. - *  In text form, Parts32[3] comes first, and Parts32[0] comes last. - * - *  For example: - * - *    xxyyzzaa-0-1234-ff - * - *      xx is byte [0] - *      yy is byte [1] - *      zz is byte [2] - *      12 is byte [8] - *      34 is byte [9] - *      ff is byte [15] - */ +//! TGuid is 16-byte value that might be interpreted as four little-endian 32-bit integers or two 64-bit little-endian integers.  +/*!  + *    *-------------------------*-------------------------*  + *    |       Parts64[0]        |       Parts64[1]        |  + *    *------------*------------*------------*------------*  + *    | Parts32[0] | Parts32[1] | Parts32[2] | Parts32[3] |  + *    *------------*------------*------------*------------*  + *    | 15..............................................0 |  + *    *---------------------------------------------------*  + *  + *  Note, that bytes are kept in memory in reverse order.  + *  + *  Canonical text representation of guid consists of four base-16 numbers.  + *  In text form, Parts32[3] comes first, and Parts32[0] comes last.  + *  + *  For example:  + *  + *    xxyyzzaa-0-1234-ff  + *  + *      xx is byte [0]  + *      yy is byte [1]  + *      zz is byte [2]  + *      12 is byte [8]  + *      34 is byte [9]  + *      ff is byte [15]  + */   struct TGuid  {      union      {          ui32 Parts32[4];          ui64 Parts64[2]; -        ui8 ReversedParts8[16]; +        ui8 ReversedParts8[16];       };      //! Constructs a null (zero) guid. @@ -97,7 +97,7 @@ Y_DECLARE_PODTYPE(NYT::TGuid);  //! A hasher for TGuid.  template <> -struct THash<NYT::TGuid> +struct THash<NYT::TGuid>   {      size_t operator()(const NYT::TGuid& guid) const;  }; diff --git a/library/cpp/yt/misc/port.h b/library/cpp/yt/misc/port.h index b24ac509959..88335abf405 100644 --- a/library/cpp/yt/misc/port.h +++ b/library/cpp/yt/misc/port.h @@ -32,7 +32,7 @@  #endif  // Configure SSE usage. -#ifdef SSE42_ENABLED +#ifdef SSE42_ENABLED       #define YT_USE_SSE42  #endif diff --git a/library/cpp/yt/misc/variant.h b/library/cpp/yt/misc/variant.h index 27c0a2bc086..a1fd8bedf19 100644 --- a/library/cpp/yt/misc/variant.h +++ b/library/cpp/yt/misc/variant.h @@ -31,9 +31,9 @@ class TStringBuilderBase;  template <class... Ts>  void FormatValue(TStringBuilderBase* builder, const std::variant<Ts...>& variant, TStringBuf spec); -template <class... Ts> +template <class... Ts>   TString ToString(const std::variant<Ts...>& variant); - +   ////////////////////////////////////////////////////////////////////////////////  //! A concise way of creating a functor with an overloaded operator(). diff --git a/library/cpp/yt/small_containers/compact_set.h b/library/cpp/yt/small_containers/compact_set.h index 2ca8713ea72..eb35a2df51a 100644 --- a/library/cpp/yt/small_containers/compact_set.h +++ b/library/cpp/yt/small_containers/compact_set.h @@ -50,7 +50,7 @@ public:      TCompactSet() {}      [[nodiscard]] bool empty() const; - +       size_type size() const;      const T& front() const; diff --git a/library/cpp/yt/small_containers/compact_vector-inl.h b/library/cpp/yt/small_containers/compact_vector-inl.h index 52507e4768f..d712f5a8fe2 100644 --- a/library/cpp/yt/small_containers/compact_vector-inl.h +++ b/library/cpp/yt/small_containers/compact_vector-inl.h @@ -734,7 +734,7 @@ void TCompactVector<T, N>::EnsureOnHeapCapacity(size_t newCapacity, bool increme      }      auto byteSize = sizeof(TOnHeapStorage) + newCapacity * sizeof(T); -    byteSize = nallocx(byteSize, 0); +    byteSize = nallocx(byteSize, 0);       newCapacity = (byteSize - sizeof(TOnHeapStorage)) / sizeof(T); diff --git a/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp b/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp index 0b2f2906922..012f31195f9 100644 --- a/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp +++ b/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp @@ -1,4 +1,4 @@ -#include <yt/yt/core/test_framework/framework.h> +#include <yt/yt/core/test_framework/framework.h>   #include <yt/yt/core/misc/compact_flat_map.h> diff --git a/library/cpp/yt/string/unittests/guid_ut.cpp b/library/cpp/yt/string/unittests/guid_ut.cpp index 4b5eebea16e..629f56ff1a8 100644 --- a/library/cpp/yt/string/unittests/guid_ut.cpp +++ b/library/cpp/yt/string/unittests/guid_ut.cpp @@ -3,8 +3,8 @@  #include <library/cpp/yt/string/guid.h>  #include <library/cpp/yt/string/format.h> -#include <util/string/hex.h> - +#include <util/string/hex.h>  +   namespace NYT {  namespace { @@ -21,10 +21,10 @@ TString CanonicalToString(TGuid value)          value.Parts32[0]);  } -const ui32 TrickyValues[] = { -    0, 0x1, 0x12, 0x123, 0x1234, 0x12345, 0x123456, 0x1234567, 0x12345678 -}; - +const ui32 TrickyValues[] = {  +    0, 0x1, 0x12, 0x123, 0x1234, 0x12345, 0x123456, 0x1234567, 0x12345678  +};  +   TEST(TGuidTest, FormatAllTricky)  {      for (ui32 a : TrickyValues) { @@ -44,14 +44,14 @@ TEST(TGuidTest, FormatAllSymbols)      const auto Value = TGuid::FromString("12345678-abcdef01-12345678-abcdef01");      EXPECT_EQ(CanonicalToString(Value), ToString(Value));  } - -TEST(TGuidTest, ByteOrder) -{ -    auto guid = TGuid::FromStringHex32("12345678ABCDEF0112345678ABCDEF01"); -    TString bytes{reinterpret_cast<const char*>(&(guid.Parts32[0])), 16}; -    EXPECT_EQ(HexEncode(bytes), "01EFCDAB7856341201EFCDAB78563412"); -} - +  +TEST(TGuidTest, ByteOrder)  +{  +    auto guid = TGuid::FromStringHex32("12345678ABCDEF0112345678ABCDEF01");  +    TString bytes{reinterpret_cast<const char*>(&(guid.Parts32[0])), 16};  +    EXPECT_EQ(HexEncode(bytes), "01EFCDAB7856341201EFCDAB78563412");  +}  +   ////////////////////////////////////////////////////////////////////////////////  } // namespace diff --git a/library/cpp/ytalloc/api/fallback.cpp b/library/cpp/ytalloc/api/fallback.cpp index 5880ede439b..a729e46f3ba 100644 --- a/library/cpp/ytalloc/api/fallback.cpp +++ b/library/cpp/ytalloc/api/fallback.cpp @@ -21,10 +21,10 @@ Y_WEAK void* AllocatePageAligned(size_t size)  {  #if defined(_win_)      return ::_aligned_malloc(size, PageSize); -#elif defined(_darwin_) || !defined(_musl_) -    return ::valloc(size); +#elif defined(_darwin_) || !defined(_musl_)  +    return ::valloc(size);   #else -    return ::memalign(PageSize, size); +    return ::memalign(PageSize, size);   #endif  } diff --git a/library/cpp/ytalloc/api/ytalloc.h b/library/cpp/ytalloc/api/ytalloc.h index d942dde6389..1088fec177f 100644 --- a/library/cpp/ytalloc/api/ytalloc.h +++ b/library/cpp/ytalloc/api/ytalloc.h @@ -190,7 +190,7 @@ void SetBacktraceFormatter(TBacktraceFormatter provider);  //! Typically invoked on application startup to lock all binaries in memory  //! and prevent executable code and static data to be paged out  //! causing latency spikes. -void MlockFileMappings(bool populate = true); +void MlockFileMappings(bool populate = true);   ////////////////////////////////////////////////////////////////////////////////  // Configuration API @@ -349,7 +349,7 @@ DEFINE_ENUM(ETimingEventType,      (MadviseDontNeed)      (Locking)      (Prefault) -    (FilePrefault) +    (FilePrefault)   );  struct TTimingEventCounters diff --git a/library/cpp/ytalloc/ya.make b/library/cpp/ytalloc/ya.make index 97aa73c135b..f0771169f73 100644 --- a/library/cpp/ytalloc/ya.make +++ b/library/cpp/ytalloc/ya.make @@ -12,6 +12,6 @@ RECURSE(  IF (YT_ALLOC_ENABLED)      RECURSE(          ut -        benchmarks +        benchmarks       )  ENDIF()  | 
