Browse Source

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

sharpeye 3 years ago
parent
commit
5ba59e58ca
5 changed files with 49 additions and 49 deletions
  1. 5 5
      library/cpp/lwtrace/probe.h
  2. 4 4
      library/cpp/lwtrace/trace.cpp
  3. 21 21
      util/generic/scope.h
  4. 18 18
      util/generic/scope_ut.cpp
  5. 1 1
      util/thread/fwd.h

+ 5 - 5
library/cpp/lwtrace/probe.h

@@ -7,7 +7,7 @@
 
 #include <util/datetime/cputimer.h>
 #include <util/generic/hide_ptr.h>
-#include <util/generic/scope.h> 
+#include <util/generic/scope.h>
 #include <util/system/atomic.h>
 
 namespace NLWTrace {
@@ -235,8 +235,8 @@ namespace NLWTrace {
         inline void operator()(LWTRACE_FUNCTION_PARAMS) {
             TParams params;
             LWTRACE_PREPARE_PARAMS(params);
-            Y_DEFER { TUserSignature<LWTRACE_TEMPLATE_ARGS>::DestroyParams(params); }; 
- 
+            Y_DEFER { TUserSignature<LWTRACE_TEMPLATE_ARGS>::DestroyParams(params); };
+
             TOrbit orbit;
             Probe.RunExecutors(orbit, params);
         }
@@ -244,8 +244,8 @@ namespace NLWTrace {
         inline void Run(TOrbit& orbit, LWTRACE_FUNCTION_PARAMS) {
             TParams params;
             LWTRACE_PREPARE_PARAMS(params);
-            Y_DEFER { TUserSignature<LWTRACE_TEMPLATE_ARGS>::DestroyParams(params); }; 
- 
+            Y_DEFER { TUserSignature<LWTRACE_TEMPLATE_ARGS>::DestroyParams(params); };
+
             Probe.RunExecutors(orbit, params);
             Probe.RunShuttles(orbit, params); // Executors can create shuttles
         }

+ 4 - 4
library/cpp/lwtrace/trace.cpp

@@ -709,10 +709,10 @@ namespace NLWTrace {
                 TString val1 = (expectedArgumentCount <= 1) ? "" : statement.GetArgument(1).GetValue();
                 TString val2 = (expectedArgumentCount <= 2) ? "" : statement.GetArgument(2).GetValue();
 
-                const char* tName1 = (expectedArgumentCount <= 1 || arg1.ParamIdx == size_t(-1)) 
-                    ? nullptr : probe->Event.Signature.ParamTypes[arg1.ParamIdx]; 
-                const char* tName2 = (expectedArgumentCount <= 2 || arg2.ParamIdx == size_t(-1)) 
-                    ? nullptr : probe->Event.Signature.ParamTypes[arg2.ParamIdx]; 
+                const char* tName1 = (expectedArgumentCount <= 1 || arg1.ParamIdx == size_t(-1))
+                    ? nullptr : probe->Event.Signature.ParamTypes[arg1.ParamIdx];
+                const char* tName2 = (expectedArgumentCount <= 2 || arg2.ParamIdx == size_t(-1))
+                    ? nullptr : probe->Event.Signature.ParamTypes[arg2.ParamIdx];
 
                 if (arg0.Type == OT_VARIABLE) {
                     switch (statement.GetType()) {

+ 21 - 21
util/generic/scope.h

@@ -1,43 +1,43 @@
 #pragma once
 
-#include <util/system/compiler.h> 
+#include <util/system/compiler.h>
 #include <util/system/defaults.h>
- 
-#include <utility> 
 
-namespace NPrivate { 
-    template <typename F> 
-    class TScopeGuard { 
-    public: 
-        TScopeGuard(const F& function) 
+#include <utility>
+
+namespace NPrivate {
+    template <typename F>
+    class TScopeGuard {
+    public:
+        TScopeGuard(const F& function)
             : Function_{function}
         {
         }
 
-        TScopeGuard(F&& function) 
+        TScopeGuard(F&& function)
             : Function_{std::move(function)}
         {
         }
 
-        TScopeGuard(TScopeGuard&&) = default; 
-        TScopeGuard(const TScopeGuard&) = default; 
- 
-        ~TScopeGuard() { 
-            Function_(); 
-        } 
- 
+        TScopeGuard(TScopeGuard&&) = default;
+        TScopeGuard(const TScopeGuard&) = default;
+
+        ~TScopeGuard() {
+            Function_();
+        }
+
     private:
         F Function_;
     };
 
-    struct TMakeGuardHelper { 
-        template <class F> 
+    struct TMakeGuardHelper {
+        template <class F>
         TScopeGuard<F> operator|(F&& function) const {
-            return std::forward<F>(function); 
-        } 
+            return std::forward<F>(function);
+        }
     };
 }
- 
+
 // \brief `Y_SCOPE_EXIT(captures) { body };`
 //
 // General implementaion of RAII idiom (resource acquisition is initialization). Executes

+ 18 - 18
util/generic/scope_ut.cpp

@@ -8,30 +8,30 @@ Y_UNIT_TEST_SUITE(ScopeToolsTest) {
         int i = 0;
 
         {
-            Y_SCOPE_EXIT(&i) { 
-                i = i * 2; 
-            }; 
- 
-            Y_SCOPE_EXIT(&i) { 
-                i = i + 1; 
-            }; 
+            Y_SCOPE_EXIT(&i) {
+                i = i * 2;
+            };
+
+            Y_SCOPE_EXIT(&i) {
+                i = i + 1;
+            };
         }
 
         UNIT_ASSERT_VALUES_EQUAL(2, i);
     }
- 
+
     Y_UNIT_TEST(OnScopeExitMoveTest) {
         THolder<int> i{new int{10}};
-        int p = 0; 
- 
-        { 
-            Y_SCOPE_EXIT(i = std::move(i), &p) { 
-                p = *i * 2; 
-            }; 
-        } 
- 
-        UNIT_ASSERT_VALUES_EQUAL(20, p); 
-    } 
+        int p = 0;
+
+        {
+            Y_SCOPE_EXIT(i = std::move(i), &p) {
+                p = *i * 2;
+            };
+        }
+
+        UNIT_ASSERT_VALUES_EQUAL(20, p);
+    }
 
     Y_UNIT_TEST(TestDefer) {
         int i = 0;

+ 1 - 1
util/thread/fwd.h

@@ -11,7 +11,7 @@ template <class T, class TCounter = TDefaultLFCounter>
 class TAutoLockFreeQueue;
 
 template <class T>
-class TLockFreeStack; 
+class TLockFreeStack;
 
 class IThreadFactory;