Browse Source

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

skalsin 3 years ago
parent
commit
5036b5f212

+ 6 - 6
build/scripts/wrapper.py

@@ -1,11 +1,11 @@
-import os 
-import sys 
- 
- 
+import os
+import sys
+
+
 if __name__ == '__main__':
     path = sys.argv[1]
- 
+
     if path[0] != '/':
         path = os.path.join(os.path.dirname(__file__), path)
- 
+
     os.execv(path, [path] + sys.argv[2:])

+ 1 - 1
contrib/libs/highwayhash/ya.make

@@ -10,7 +10,7 @@ OWNER(somov)
 
 NO_COMPILER_WARNINGS()
 
-ADDINCL(GLOBAL contrib/libs/highwayhash) 
+ADDINCL(GLOBAL contrib/libs/highwayhash)
 
 SRCDIR(contrib/libs/highwayhash/highwayhash)
 

+ 1 - 1
contrib/libs/ya.make

@@ -393,7 +393,7 @@ IF (OS_LINUX)
         ibdrv
         ibdrv/ut
         proc
-        luajit 
+        luajit
         luajit_21
         libaio
         libcap

+ 11 - 11
library/cpp/string_utils/quote/quote.cpp

@@ -180,9 +180,9 @@ TString& AppendCgiEscaped(const TStringBuf value, TString& to) {
 // additional characters that should not be quoted — its default value is '/'.
 
 // Also returns pointer to the end of result string.
- 
-template <class It1, class It2, class It3> 
-static inline It1 Quote(It1 to, It2 from, It3 end, const char* safe) { 
+
+template <class It1, class It2, class It3>
+static inline It1 Quote(It1 to, It2 from, It3 end, const char* safe) {
     bool escape_map[256];
     memcpy(escape_map, chars_to_url_escape, 256);
     // RFC 3986 Uniform Resource Identifiers (URI): Generic Syntax
@@ -196,22 +196,22 @@ static inline It1 Quote(It1 to, It2 from, It3 end, const char* safe) {
         escape_map[(unsigned char)*p] = 0;
     }
 
-    return Escape(to, from, end, escape_map); 
+    return Escape(to, from, end, escape_map);
+}
+
+char* Quote(char* to, const char* from, const char* safe) {
+    return Quote(to, FixZero(from), TCStringEndIterator(), safe);
 }
 
-char* Quote(char* to, const char* from, const char* safe) { 
-    return Quote(to, FixZero(from), TCStringEndIterator(), safe); 
-} 
- 
 char* Quote(char* to, const TStringBuf s, const char* safe) {
     return Quote(to, s.data(), s.data() + s.size(), safe);
-} 
- 
+}
+
 void Quote(TString& url, const char* safe) {
     TTempBuf tempBuf(CgiEscapeBufLen(url.size()));
     char* to = tempBuf.Data();
 
-    url.AssignNoAlias(to, Quote(to, url, safe)); 
+    url.AssignNoAlias(to, Quote(to, url, safe));
 }
 
 char* CGIUnescape(char* to, const char* from) {

+ 5 - 5
library/cpp/string_utils/quote/quote_ut.cpp

@@ -310,10 +310,10 @@ Y_UNIT_TEST_SUITE(TQuoteTest) {
         Quote(s, ";,");
         UNIT_ASSERT_VALUES_EQUAL("%2Fpath;tail%2Fpath,tail%2F", s.c_str());
     }
- 
+
     Y_UNIT_TEST(StringBuf) {
-        char r[100]; 
-        char* end = Quote(r, "abc\0/path", ""); 
-        UNIT_ASSERT_VALUES_EQUAL("abc\0%2Fpath", TStringBuf(r, end)); 
-    } 
+        char r[100];
+        char* end = Quote(r, "abc\0/path", "");
+        UNIT_ASSERT_VALUES_EQUAL("abc\0%2Fpath", TStringBuf(r, end));
+    }
 }

+ 2 - 2
util/digest/multi.pxd

@@ -1,2 +1,2 @@
-cdef extern from "<util/digest/multi.h>" nogil: 
-    size_t MultiHash(...); 
+cdef extern from "<util/digest/multi.h>" nogil:
+    size_t MultiHash(...);

+ 16 - 16
util/digest/multi_ut.pyx

@@ -1,19 +1,19 @@
-from util.digest.multi cimport MultiHash 
+from util.digest.multi cimport MultiHash
 from util.generic.string cimport TString
- 
-import pytest 
-import unittest 
- 
- 
-class TestMultiHash(unittest.TestCase): 
- 
-    def test_str_int(self): 
+
+import pytest
+import unittest
+
+
+class TestMultiHash(unittest.TestCase):
+
+    def test_str_int(self):
         value = MultiHash(TString(b"1234567"), 123)
-        self.assertEquals(value, 17038203285960021630) 
- 
-    def test_int_str(self): 
+        self.assertEquals(value, 17038203285960021630)
+
+    def test_int_str(self):
         value = MultiHash(123, TString(b"1234567"))
-        self.assertEquals(value, 9973288649881090712) 
- 
-    def test_collision(self): 
-        self.assertNotEquals(MultiHash(1, 1, 0), MultiHash(2, 2, 0)) 
+        self.assertEquals(value, 9973288649881090712)
+
+    def test_collision(self):
+        self.assertNotEquals(MultiHash(1, 1, 0), MultiHash(2, 2, 0))

+ 54 - 54
util/generic/hash.h

@@ -676,24 +676,24 @@ public:
     template <class OtherValue>
     iterator insert_equal(const OtherValue& obj) {
         reserve(num_elements + 1);
-        return emplace_equal_noresize(obj); 
+        return emplace_equal_noresize(obj);
     }
 
-    template <typename... Args> 
+    template <typename... Args>
     iterator emplace_equal(Args&&... args) {
         reserve(num_elements + 1);
-        return emplace_equal_noresize(std::forward<Args>(args)...); 
-    } 
- 
+        return emplace_equal_noresize(std::forward<Args>(args)...);
+    }
+
     template <class OtherValue>
     iterator insert_direct(const OtherValue& obj, insert_ctx ins) {
-        return emplace_direct(ins, obj); 
-    } 
- 
-    template <typename... Args> 
+        return emplace_direct(ins, obj);
+    }
+
+    template <typename... Args>
     iterator emplace_direct(insert_ctx ins, Args&&... args) {
         bool resized = reserve(num_elements + 1);
-        node* tmp = new_node(std::forward<Args>(args)...); 
+        node* tmp = new_node(std::forward<Args>(args)...);
         if (resized) {
             find_i(get_key(tmp->val), ins);
         }
@@ -703,19 +703,19 @@ public:
         return iterator(tmp);
     }
 
-    template <typename... Args> 
+    template <typename... Args>
     std::pair<iterator, bool> emplace_unique(Args&&... args) {
         reserve(num_elements + 1);
-        return emplace_unique_noresize(std::forward<Args>(args)...); 
-    } 
- 
-    template <typename... Args> 
+        return emplace_unique_noresize(std::forward<Args>(args)...);
+    }
+
+    template <typename... Args>
     std::pair<iterator, bool> emplace_unique_noresize(Args&&... args);
- 
+
     template <class OtherValue>
     std::pair<iterator, bool> insert_unique_noresize(const OtherValue& obj);
 
-    template <typename... Args> 
+    template <typename... Args>
     iterator emplace_equal_noresize(Args&&... args);
 
     template <class InputIterator>
@@ -755,7 +755,7 @@ public:
 
         reserve(num_elements + n);
         for (; n > 0; --n, ++f)
-            emplace_equal_noresize(*f); 
+            emplace_equal_noresize(*f);
     }
 
     template <class OtherValue>
@@ -929,12 +929,12 @@ private:
         return bkt_num_key(get_key(obj), n);
     }
 
-    template <typename... Args> 
+    template <typename... Args>
     node* new_node(Args&&... val) {
         node* n = get_node();
         n->next = (node*)1; /*y*/ // just for a case
         try {
-            new (static_cast<void*>(&n->val)) Value(std::forward<Args>(val)...); 
+            new (static_cast<void*>(&n->val)) Value(std::forward<Args>(val)...);
         } catch (...) {
             put_node(n);
             throw;
@@ -997,28 +997,28 @@ inline __yhashtable_const_iterator<V> __yhashtable_const_iterator<V>::operator++
 }
 
 template <class V, class K, class HF, class Ex, class Eq, class A>
-template <typename... Args> 
+template <typename... Args>
 std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V, K, HF, Ex, Eq, A>::emplace_unique_noresize(Args&&... args) {
     auto deleter = [&](node* tmp) { delete_node(tmp); };
-    node* tmp = new_node(std::forward<Args>(args)...); 
-    std::unique_ptr<node, decltype(deleter)> guard(tmp, deleter); 
- 
-    const size_type n = bkt_num(tmp->val); 
-    node* first = buckets[n]; 
- 
-    if (first)                                                          /*y*/ 
-        for (node* cur = first; !((uintptr_t)cur & 1); cur = cur->next) /*y*/ 
-            if (equals(get_key(cur->val), get_key(tmp->val))) 
-                return std::pair<iterator, bool>(iterator(cur), false); /*y*/ 
- 
-    guard.release(); 
-    tmp->next = first ? first : (node*)((uintptr_t)&buckets[n + 1] | 1); /*y*/ 
-    buckets[n] = tmp; 
-    ++num_elements; 
-    return std::pair<iterator, bool>(iterator(tmp), true); /*y*/ 
-} 
- 
-template <class V, class K, class HF, class Ex, class Eq, class A> 
+    node* tmp = new_node(std::forward<Args>(args)...);
+    std::unique_ptr<node, decltype(deleter)> guard(tmp, deleter);
+
+    const size_type n = bkt_num(tmp->val);
+    node* first = buckets[n];
+
+    if (first)                                                          /*y*/
+        for (node* cur = first; !((uintptr_t)cur & 1); cur = cur->next) /*y*/
+            if (equals(get_key(cur->val), get_key(tmp->val)))
+                return std::pair<iterator, bool>(iterator(cur), false); /*y*/
+
+    guard.release();
+    tmp->next = first ? first : (node*)((uintptr_t)&buckets[n + 1] | 1); /*y*/
+    buckets[n] = tmp;
+    ++num_elements;
+    return std::pair<iterator, bool>(iterator(tmp), true); /*y*/
+}
+
+template <class V, class K, class HF, class Ex, class Eq, class A>
 template <class OtherValue>
 std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V, K, HF, Ex, Eq, A>::insert_unique_noresize(const OtherValue& obj) {
     const size_type n = bkt_num(obj);
@@ -1037,25 +1037,25 @@ std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V
 }
 
 template <class V, class K, class HF, class Ex, class Eq, class A>
-template <typename... Args> 
+template <typename... Args>
 __yhashtable_iterator<V> THashTable<V, K, HF, Ex, Eq, A>::emplace_equal_noresize(Args&&... args) {
     auto deleter = [&](node* tmp) { delete_node(tmp); };
-    node* tmp = new_node(std::forward<Args>(args)...); 
-    std::unique_ptr<node, decltype(deleter)> guard(tmp, deleter); 
-    const size_type n = bkt_num(tmp->val); 
+    node* tmp = new_node(std::forward<Args>(args)...);
+    std::unique_ptr<node, decltype(deleter)> guard(tmp, deleter);
+    const size_type n = bkt_num(tmp->val);
     node* first = buckets[n];
 
     if (first)                                                          /*y*/
         for (node* cur = first; !((uintptr_t)cur & 1); cur = cur->next) /*y*/
-            if (equals(get_key(cur->val), get_key(tmp->val))) { 
-                guard.release(); 
+            if (equals(get_key(cur->val), get_key(tmp->val))) {
+                guard.release();
                 tmp->next = cur->next;
                 cur->next = tmp;
                 ++num_elements;
                 return iterator(tmp); /*y*/
             }
 
-    guard.release(); 
+    guard.release();
     tmp->next = first ? first : (node*)((uintptr_t)&buckets[n + 1] | 1); /*y*/
     buckets[n] = tmp;
     ++num_elements;
@@ -1570,10 +1570,10 @@ public:
         return rep.insert_unique(obj);
     }
 
-    template <typename... Args> 
+    template <typename... Args>
     std::pair<iterator, bool> emplace(Args&&... args) {
-        return rep.emplace_unique(std::forward<Args>(args)...); 
-    } 
+        return rep.emplace_unique(std::forward<Args>(args)...);
+    }
 
     std::pair<iterator, bool> insert_noresize(const value_type& obj) {
         return rep.insert_unique_noresize(obj);
@@ -1644,7 +1644,7 @@ public:
             return it->second;
         }
 
-        return rep.emplace_direct(ctx, std::piecewise_construct, std::forward_as_tuple(key), std::forward_as_tuple())->second; 
+        return rep.emplace_direct(ctx, std::piecewise_construct, std::forward_as_tuple(key), std::forward_as_tuple())->second;
     }
 
     template <class TheKey>
@@ -1897,11 +1897,11 @@ public:
 
     template <typename... Args>
     iterator emplace(Args&&... args) {
-        return rep.emplace_equal(std::forward<Args>(args)...); 
-    } 
+        return rep.emplace_equal(std::forward<Args>(args)...);
+    }
 
     iterator insert_noresize(const value_type& obj) {
-        return rep.emplace_equal_noresize(obj); 
+        return rep.emplace_equal_noresize(obj);
     }
 
     template <typename... Args>

+ 20 - 20
util/generic/hash_ut.cpp

@@ -37,7 +37,7 @@ class THashTest: public TTestBase {
     UNIT_TEST(TestInvariants);
     UNIT_TEST(TestAllocation);
     UNIT_TEST(TestInsertCopy);
-    UNIT_TEST(TestEmplace); 
+    UNIT_TEST(TestEmplace);
     UNIT_TEST(TestEmplaceNoresize);
     UNIT_TEST(TestEmplaceDirect);
     UNIT_TEST(TestTryEmplace);
@@ -48,7 +48,7 @@ class THashTest: public TTestBase {
     UNIT_TEST(TestHSetEmplace);
     UNIT_TEST(TestHSetEmplaceNoresize);
     UNIT_TEST(TestHSetEmplaceDirect);
-    UNIT_TEST(TestNonCopyable); 
+    UNIT_TEST(TestNonCopyable);
     UNIT_TEST(TestValueInitialization);
     UNIT_TEST(TestAssignmentClear);
     UNIT_TEST(TestReleaseNodes);
@@ -88,7 +88,7 @@ protected:
     void TestInvariants();
     void TestAllocation();
     void TestInsertCopy();
-    void TestEmplace(); 
+    void TestEmplace();
     void TestEmplaceNoresize();
     void TestEmplaceDirect();
     void TestTryEmplace();
@@ -99,7 +99,7 @@ protected:
     void TestHMMapEmplace();
     void TestHMMapEmplaceNoresize();
     void TestHMMapEmplaceDirect();
-    void TestNonCopyable(); 
+    void TestNonCopyable();
     void TestValueInitialization();
     void TestAssignmentClear();
     void TestReleaseNodes();
@@ -887,14 +887,14 @@ void THashTest::TestInsertCopy() {
     hash[TNonCopyableInt<0>(0)] = 0;
 }
 
-void THashTest::TestEmplace() { 
+void THashTest::TestEmplace() {
     using hash_t = THashMap<int, TNonCopyableInt<0>>;
     hash_t hash;
-    hash.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(0)); 
-    auto it = hash.find(1); 
-    UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(it->second), 0); 
-} 
- 
+    hash.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(0));
+    auto it = hash.find(1);
+    UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(it->second), 0);
+}
+
 void THashTest::TestEmplaceNoresize() {
     using hash_t = THashMap<int, TNonCopyableInt<0>>;
     hash_t hash;
@@ -1037,9 +1037,9 @@ void THashTest::TestHSetEmplaceDirect() {
     UNIT_ASSERT(!hash.contains(1));
 }
 
-void THashTest::TestNonCopyable() { 
-    struct TValue: public TNonCopyable { 
-        int value; 
+void THashTest::TestNonCopyable() {
+    struct TValue: public TNonCopyable {
+        int value;
         TValue(int _value = 0)
             : value(_value)
         {
@@ -1047,16 +1047,16 @@ void THashTest::TestNonCopyable() {
         operator int() {
             return value;
         }
-    }; 
- 
+    };
+
     THashMap<int, TValue> hash;
-    hash.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(5)); 
+    hash.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(5));
     auto&& value = hash[1];
-    UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(value), 5); 
+    UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(value), 5);
     auto&& not_inserted = hash[2];
-    UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(not_inserted), 0); 
-} 
- 
+    UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(not_inserted), 0);
+}
+
 void THashTest::TestValueInitialization() {
     THashMap<int, int> hash;
 

+ 3 - 3
util/memory/tempbuf.cpp

@@ -255,10 +255,10 @@ void TTempBuf::SetPos(size_t off) {
     Impl_->SetPos(off);
 }
 
-char* TTempBuf::Proceed(size_t off) { 
-    char* ptr = Current(); 
+char* TTempBuf::Proceed(size_t off) {
+    char* ptr = Current();
     Impl_->Proceed(off);
-    return ptr; 
+    return ptr;
 }
 
 void TTempBuf::Append(const void* data, size_t len) {

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