Browse Source

Restoring authorship annotation for <sankear@yandex-team.ru>. Commit 2 of 2.

sankear 3 years ago
parent
commit
aed1c1c778

+ 19 - 19
library/cpp/containers/top_keeper/top_keeper.h

@@ -22,16 +22,16 @@ private:
 
         template <class UT>
         bool Insert(UT&& value) noexcept {
-            if (Y_UNLIKELY(0 == HalfMaxSize)) { 
+            if (Y_UNLIKELY(0 == HalfMaxSize)) {
                 return false;
             }
 
-            if (Internal.size() < HalfMaxSize) { 
+            if (Internal.size() < HalfMaxSize) {
                 if (Internal.empty() || Comparer(Internal[MinElementIndex], value)) {
                     MinElementIndex = Internal.size();
-                    Internal.push_back(std::forward<UT>(value)); 
-                    return true; 
-                } 
+                    Internal.push_back(std::forward<UT>(value));
+                    return true;
+                }
             } else if (!Comparer(value, Internal[MinElementIndex])) {
                 return false;
             }
@@ -69,11 +69,11 @@ private:
         }
 
         void Partition() {
-            if (Y_UNLIKELY(HalfMaxSize == 0)) { 
-                return; 
-            } 
-            if (Y_LIKELY(Internal.size() >= HalfMaxSize)) { 
-                NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer); 
+            if (Y_UNLIKELY(HalfMaxSize == 0)) {
+                return;
+            }
+            if (Y_LIKELY(Internal.size() >= HalfMaxSize)) {
+                NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer);
                 Internal.erase(Internal.begin() + HalfMaxSize, Internal.end());
 
                 //we should update MinElementIndex cause we just altered Internal
@@ -96,7 +96,7 @@ private:
 
         void SetMaxSize(size_t newHalfMaxSize) {
             HalfMaxSize = newHalfMaxSize;
-            Reserve(); 
+            Reserve();
             Partition();
         }
 
@@ -142,14 +142,14 @@ private:
     bool Finalized;
 
 public:
-    TTopKeeper() 
-        : MaxSize(0) 
-        , Comparer() 
-        , Internal(0, Comparer) 
-        , Finalized(false) 
-    { 
-    } 
- 
+    TTopKeeper()
+        : MaxSize(0)
+        , Comparer()
+        , Internal(0, Comparer)
+        , Finalized(false)
+    {
+    }
+
     TTopKeeper(size_t maxSize, const TComparator& comp = TComparator())
         : MaxSize(maxSize)
         , Comparer(comp)

+ 19 - 19
library/cpp/containers/top_keeper/top_keeper/top_keeper.h

@@ -22,16 +22,16 @@ private:
 
         template <class UT>
         bool Insert(UT&& value) noexcept {
-            if (Y_UNLIKELY(0 == HalfMaxSize)) { 
+            if (Y_UNLIKELY(0 == HalfMaxSize)) {
                 return false;
             }
 
-            if (Internal.size() < HalfMaxSize) { 
+            if (Internal.size() < HalfMaxSize) {
                 if (Internal.empty() || Comparer(Internal[MinElementIndex], value)) {
                     MinElementIndex = Internal.size();
-                    Internal.push_back(std::forward<UT>(value)); 
-                    return true; 
-                } 
+                    Internal.push_back(std::forward<UT>(value));
+                    return true;
+                }
             } else if (!Comparer(value, Internal[MinElementIndex])) {
                 return false;
             }
@@ -69,11 +69,11 @@ private:
         }
 
         void Partition() {
-            if (Y_UNLIKELY(HalfMaxSize == 0)) { 
-                return; 
-            } 
-            if (Y_LIKELY(Internal.size() >= HalfMaxSize)) { 
-                NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer); 
+            if (Y_UNLIKELY(HalfMaxSize == 0)) {
+                return;
+            }
+            if (Y_LIKELY(Internal.size() >= HalfMaxSize)) {
+                NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer);
                 Internal.erase(Internal.begin() + HalfMaxSize, Internal.end());
 
                 //we should update MinElementIndex cause we just altered Internal
@@ -96,7 +96,7 @@ private:
 
         void SetMaxSize(size_t newHalfMaxSize) {
             HalfMaxSize = newHalfMaxSize;
-            Reserve(); 
+            Reserve();
             Partition();
         }
 
@@ -142,14 +142,14 @@ private:
     bool Finalized;
 
 public:
-    TTopKeeper() 
-        : MaxSize(0) 
-        , Comparer() 
-        , Internal(0, Comparer) 
-        , Finalized(false) 
-    { 
-    } 
- 
+    TTopKeeper()
+        : MaxSize(0)
+        , Comparer()
+        , Internal(0, Comparer)
+        , Finalized(false)
+    {
+    }
+
     TTopKeeper(size_t maxSize, const TComparator& comp = TComparator())
         : MaxSize(maxSize)
         , Comparer(comp)

+ 7 - 7
library/cpp/deprecated/mapped_file/mapped_file.cpp

@@ -14,7 +14,7 @@ TMappedFile::TMappedFile(TFileMap* map, const char* dbgName) {
     Map_->Map(0, static_cast<size_t>(len));
 }
 
-TMappedFile::TMappedFile(const TFile& file, TFileMap::EOpenMode om, const char* dbgName) 
+TMappedFile::TMappedFile(const TFile& file, TFileMap::EOpenMode om, const char* dbgName)
     : Map_(nullptr)
 {
     init(file, om, dbgName);
@@ -28,13 +28,13 @@ void TMappedFile::precharge(size_t off, size_t size) const {
 }
 
 void TMappedFile::init(const TString& name) {
-    THolder<TFileMap> map(new TFileMap(name)); 
+    THolder<TFileMap> map(new TFileMap(name));
     TMappedFile newFile(map.Get(), name.data());
     Y_UNUSED(map.Release());
-    newFile.swap(*this); 
-    newFile.term(); 
-} 
- 
+    newFile.swap(*this);
+    newFile.term();
+}
+
 void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode om) {
     THolder<TFileMap> map(new TFileMap(name, length, om));
     TMappedFile newFile(map.Get(), name.data());
@@ -43,7 +43,7 @@ void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode o
     newFile.term();
 }
 
-void TMappedFile::init(const TFile& file, TFileMap::EOpenMode om, const char* dbgName) { 
+void TMappedFile::init(const TFile& file, TFileMap::EOpenMode om, const char* dbgName) {
     THolder<TFileMap> map(new TFileMap(file, om));
     TMappedFile newFile(map.Get(), dbgName);
     Y_UNUSED(map.Release());

+ 4 - 4
library/cpp/deprecated/mapped_file/mapped_file.h

@@ -32,10 +32,10 @@ public:
 
     explicit TMappedFile(const TString& name) {
         Map_ = nullptr;
-        init(name, TFileMap::oRdOnly); 
+        init(name, TFileMap::oRdOnly);
     }
 
-    TMappedFile(const TFile& file, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown"); 
+    TMappedFile(const TFile& file, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown");
 
     void init(const TString& name);
 
@@ -43,8 +43,8 @@ public:
 
     void init(const TString& name, size_t length, TFileMap::EOpenMode om);
 
-    void init(const TFile&, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown"); 
- 
+    void init(const TFile&, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown");
+
     void flush();
 
     void term() {

+ 9 - 9
util/generic/maybe.h

@@ -708,15 +708,15 @@ template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<
 constexpr bool operator>=(const U& value, const TMaybe<T, TPolicy>& maybe) {
     return !(value < maybe);
 }
- 
+
 class IOutputStream;
- 
-template <class T, class TPolicy> 
+
+template <class T, class TPolicy>
 inline IOutputStream& operator<<(IOutputStream& out, const TMaybe<T, TPolicy>& maybe) {
-    if (maybe.Defined()) { 
-        out << *maybe; 
-    } else { 
+    if (maybe.Defined()) {
+        out << *maybe;
+    } else {
         out << TStringBuf("(empty maybe)");
-    } 
-    return out; 
-} 
+    }
+    return out;
+}

+ 10 - 10
util/generic/maybe_ut.cpp

@@ -787,14 +787,14 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
             UNIT_ASSERT(m2 == Nothing());
         }
     }
- 
+
     Y_UNIT_TEST(TestOutputStreamEmptyMaybe) {
         TString s;
-        TStringOutput output(s); 
-        output << TMaybe<int>(); 
-        UNIT_ASSERT_EQUAL("(empty maybe)", s); 
-    } 
- 
+        TStringOutput output(s);
+        output << TMaybe<int>();
+        UNIT_ASSERT_EQUAL("(empty maybe)", s);
+    }
+
     Y_UNIT_TEST(TestOutputStreamNothing) {
         TString s;
         TStringOutput output(s);
@@ -804,10 +804,10 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
 
     Y_UNIT_TEST(TestOutputStreamDefinedMaybe) {
         TString s;
-        TStringOutput output(s); 
-        output << TMaybe<int>(42); 
-        UNIT_ASSERT_EQUAL("42", s); 
-    } 
+        TStringOutput output(s);
+        output << TMaybe<int>(42);
+        UNIT_ASSERT_EQUAL("42", s);
+    }
 
     Y_UNIT_TEST(TestMaybeCovarianceImplicit) {
         struct TestStruct {

+ 2 - 2
util/generic/vector.h

@@ -73,7 +73,7 @@ public:
     }
 
     inline TVector(TSelf&& src) noexcept
-        : TBase(std::forward<TSelf>(src)) 
+        : TBase(std::forward<TSelf>(src))
     {
     }
 
@@ -89,7 +89,7 @@ public:
     }
 
     inline TSelf& operator=(TSelf&& src) noexcept {
-        TBase::operator=(std::forward<TSelf>(src)); 
+        TBase::operator=(std::forward<TSelf>(src));
         return *this;
     }
 

+ 6 - 6
util/memory/blob.cpp

@@ -284,14 +284,14 @@ TBlob TBlob::LockedFromFile(const TFile& file) {
     return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Locked);
 }
 
-TBlob TBlob::LockedFromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) { 
+TBlob TBlob::LockedFromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
     return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Locked);
-} 
- 
-TBlob TBlob::LockedFromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) { 
+}
+
+TBlob TBlob::LockedFromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
     return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Locked);
-} 
- 
+}
+
 TBlob TBlob::FromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
     return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Standard);
 }

+ 6 - 6
util/memory/blob.h

@@ -250,12 +250,12 @@ public:
     /// Creates a locked blob with a multi-threaded (atomic) refcounter. It maps the file content as data.
     static TBlob LockedFromFile(const TFile& file);
 
-    /// Creates a locked blob with a single-threaded (non atomic) refcounter from the mapped memory. 
-    static TBlob LockedFromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length); 
- 
-    /// 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 locked blob with a single-threaded (non atomic) refcounter from the mapped memory.
+    static TBlob LockedFromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length);
+
+    /// 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.
     static TBlob FromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length);
 

+ 9 - 9
util/string/vector.cpp

@@ -12,7 +12,7 @@ static inline void DoSplit2(TConsumer& c, TDelim& d, const TBasicStringBuf<TChr>
 template <class TConsumer, class TDelim, typename TChr>
 static inline void DoSplit1(TConsumer& cc, TDelim& d, const TBasicStringBuf<TChr> str, int opts) {
     if (opts & KEEP_EMPTY_TOKENS) {
-        DoSplit2(cc, d, str, opts); 
+        DoSplit2(cc, d, str, opts);
     } else {
         TSkipEmptyTokens<TConsumer> sc(&cc);
 
@@ -35,13 +35,13 @@ static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d,
     if (maxFields) {
         TLimitingConsumer<TConsumer, const TChr> lc(maxFields, &cc);
 
-        DoSplit1(lc, d, str, options); 
+        DoSplit1(lc, d, str, options);
 
         if (lc.Last) {
             res->push_back(TStringType(lc.Last, str.data() + str.size() - lc.Last));
         }
     } else {
-        DoSplit1(cc, d, str, options); 
+        DoSplit1(cc, d, str, options);
     }
 }
 
@@ -55,11 +55,11 @@ static void SplitStringImplT(TVector<std::conditional_t<std::is_same<TChr, wchar
     if (*(delim + 1)) {
         TStringDelimiter<const TChr> d(delim, std::char_traits<TChr>::length(delim));
 
-        DoSplit0(res, str, d, maxFields, options); 
+        DoSplit0(res, str, d, maxFields, options);
     } else {
         TCharDelimiter<const TChr> d(*delim);
 
-        DoSplit0(res, str, d, maxFields, options); 
+        DoSplit0(res, str, d, maxFields, options);
     }
 }
 
@@ -69,16 +69,16 @@ void ::NPrivate::SplitStringImpl(TVector<TString>* res, const char* ptr, const c
 
 void ::NPrivate::SplitStringImpl(TVector<TString>* res, const char* ptr, size_t len, const char* delim, size_t maxFields, int options) {
     return SplitStringImplT<char>(res, TStringBuf(ptr, len), delim, maxFields, options);
-} 
- 
+}
+
 void ::NPrivate::SplitStringImpl(TVector<TUtf16String>* res, const wchar16* ptr, const wchar16* delimiter, size_t maxFields, int options) {
     return SplitStringImplT<wchar16>(res, TWtringBuf(ptr), delimiter, maxFields, options);
 }
 
 void ::NPrivate::SplitStringImpl(TVector<TUtf16String>* res, const wchar16* ptr, size_t len, const wchar16* delimiter, size_t maxFields, int options) {
     return SplitStringImplT<wchar16>(res, TWtringBuf(ptr, len), delimiter, maxFields, options);
-} 
- 
+}
+
 TUtf16String JoinStrings(const TVector<TUtf16String>& v, const TWtringBuf delim) {
     return JoinStrings(v.begin(), v.end(), delim);
 }

Some files were not shown because too many files changed in this diff