aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authoragri <agri@yandex-team.ru>2022-02-10 16:48:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:12 +0300
commitd3530b2692e400bd4d29bd4f07cafaee139164e7 (patch)
treeb7ae636a74490e649a2ed0fdd5361f1bec83b9f9 /util/generic
parent0f4c5d1e8c0672bf0a1f2f2d8acac5ba24772435 (diff)
downloadydb-d3530b2692e400bd4d29bd4f07cafaee139164e7.tar.gz
Restoring authorship annotation for <agri@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/ptr.h60
-rw-r--r--util/generic/refcount.h30
2 files changed, 45 insertions, 45 deletions
diff --git a/util/generic/ptr.h b/util/generic/ptr.h
index 19db0e3ec5..fd1cd162b1 100644
--- a/util/generic/ptr.h
+++ b/util/generic/ptr.h
@@ -366,19 +366,19 @@ public:
inline ~TRefCounted() = default;
inline void Ref(TAtomicBase d) noexcept {
- auto resultCount = Counter_.Add(d);
- Y_ASSERT(resultCount >= d);
- (void)resultCount;
+ auto resultCount = Counter_.Add(d);
+ Y_ASSERT(resultCount >= d);
+ (void)resultCount;
}
inline void Ref() noexcept {
- auto resultCount = Counter_.Inc();
- Y_ASSERT(resultCount != 0);
- (void)resultCount;
+ auto resultCount = Counter_.Inc();
+ Y_ASSERT(resultCount != 0);
+ (void)resultCount;
}
inline void UnRef(TAtomicBase d) noexcept {
- auto resultCount = Counter_.Sub(d);
+ auto resultCount = Counter_.Sub(d);
Y_ASSERT(resultCount >= 0);
if (resultCount == 0) {
D::Destroy(static_cast<T*>(this));
@@ -389,14 +389,14 @@ public:
UnRef(1);
}
- inline TAtomicBase RefCount() const noexcept {
+ inline TAtomicBase RefCount() const noexcept {
return Counter_.Val();
}
inline void DecRef() noexcept {
- auto resultCount = Counter_.Dec();
- Y_ASSERT(resultCount >= 0);
- (void)resultCount;
+ auto resultCount = Counter_.Dec();
+ Y_ASSERT(resultCount >= 0);
+ (void)resultCount;
}
TRefCounted(const TRefCounted&)
@@ -543,11 +543,11 @@ public:
return *this;
}
- // Effectively replace both:
- // Reset(const TIntrusivePtr&)
- // Reset(TIntrusivePtr&&)
- inline void Reset(TIntrusivePtr t) noexcept {
- Swap(t);
+ // Effectively replace both:
+ // Reset(const TIntrusivePtr&)
+ // Reset(TIntrusivePtr&&)
+ inline void Reset(TIntrusivePtr t) noexcept {
+ Swap(t);
}
inline void Reset() noexcept {
@@ -663,11 +663,11 @@ public:
return *this;
}
- // Effectively replace both:
- // Reset(const TIntrusiveConstPtr&)
- // Reset(TIntrusiveConstPtr&&)
- inline void Reset(TIntrusiveConstPtr t) noexcept {
- Swap(t);
+ // Effectively replace both:
+ // Reset(const TIntrusiveConstPtr&)
+ // Reset(TIntrusiveConstPtr&&)
+ inline void Reset(TIntrusiveConstPtr t) noexcept {
+ Swap(t);
}
inline void Reset() noexcept {
@@ -783,11 +783,11 @@ template <typename T, class Ops = TDefaultIntrusivePtrOps<T>, typename... Args>
return new T{std::forward<Args>(args)...};
}
-template <typename T, class Ops = TDefaultIntrusivePtrOps<T>, typename... Args>
+template <typename T, class Ops = TDefaultIntrusivePtrOps<T>, typename... Args>
[[nodiscard]] TIntrusiveConstPtr<T, Ops> MakeIntrusiveConst(Args&&... args) {
- return new T{std::forward<Args>(args)...};
-}
-
+ return new T{std::forward<Args>(args)...};
+}
+
template <class T, class C, class D>
class TSharedPtr: public TPointerBase<TSharedPtr<T, C, D>, T> {
template <class TT, class CC, class DD>
@@ -862,11 +862,11 @@ public:
return *this;
}
- // Effectively replace both:
- // Reset(const TSharedPtr& t)
- // Reset(TSharedPtr&& t)
- inline void Reset(TSharedPtr t) noexcept {
- Swap(t);
+ // Effectively replace both:
+ // Reset(const TSharedPtr& t)
+ // Reset(TSharedPtr&& t)
+ inline void Reset(TSharedPtr t) noexcept {
+ Swap(t);
}
inline void Reset() noexcept {
diff --git a/util/generic/refcount.h b/util/generic/refcount.h
index 966e853b77..bcee5a7860 100644
--- a/util/generic/refcount.h
+++ b/util/generic/refcount.h
@@ -19,21 +19,21 @@ public:
Check();
}
- inline TAtomicBase Add(TAtomicBase d) noexcept {
+ inline TAtomicBase Add(TAtomicBase d) noexcept {
Check();
- return Counter_ += d;
+ return Counter_ += d;
}
- inline TAtomicBase Inc() noexcept {
- return Add(1);
+ inline TAtomicBase Inc() noexcept {
+ return Add(1);
}
- inline TAtomicBase Sub(TAtomicBase d) noexcept {
+ inline TAtomicBase Sub(TAtomicBase d) noexcept {
Check();
return Counter_ -= d;
}
- inline TAtomicBase Dec() noexcept {
+ inline TAtomicBase Dec() noexcept {
return Sub(1);
}
@@ -43,17 +43,17 @@ public:
}
Inc();
- Y_ASSERT(Counter_ != 0);
-
+ Y_ASSERT(Counter_ != 0);
+
return true;
}
- inline TAtomicBase Val() const noexcept {
+ inline TAtomicBase Val() const noexcept {
return Counter_;
}
private:
- TAtomicBase Counter_;
+ TAtomicBase Counter_;
};
class TNoCheckPolicy {
@@ -109,12 +109,12 @@ public:
inline ~TAtomicCounter() = default;
- inline TAtomicBase Add(TAtomicBase d) noexcept {
- return AtomicAdd(Counter_, d);
+ inline TAtomicBase Add(TAtomicBase d) noexcept {
+ return AtomicAdd(Counter_, d);
}
- inline TAtomicBase Inc() noexcept {
- return Add(1);
+ inline TAtomicBase Inc() noexcept {
+ return Add(1);
}
inline TAtomicBase Sub(TAtomicBase d) noexcept {
@@ -138,7 +138,7 @@ public:
}
intptr_t newValue = curValue + 1;
- Y_ASSERT(newValue != 0);
+ Y_ASSERT(newValue != 0);
if (AtomicCas(&Counter_, newValue, curValue)) {
return true;