aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/utility.h
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /util/generic/utility.h
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'util/generic/utility.h')
-rw-r--r--util/generic/utility.h62
1 files changed, 31 insertions, 31 deletions
diff --git a/util/generic/utility.h b/util/generic/utility.h
index 43b98eeafc..876d67a89f 100644
--- a/util/generic/utility.h
+++ b/util/generic/utility.h
@@ -43,28 +43,28 @@ static T Mean(const Args&... other) noexcept {
}
template <class T>
-static inline void Zero(T& t) noexcept {
+static inline void Zero(T& t) noexcept {
memset((void*)&t, 0, sizeof(t));
}
-/**
- * Securely zero memory (compiler does not optimize this out)
- *
- * @param pointer void pointer to start of memory block to be zeroed
- * @param count size of memory block to be zeroed (in bytes)
- */
-void SecureZero(void* pointer, size_t count) noexcept;
-
-/**
- * Securely zero memory of given object (compiler does not optimize this out)
- *
- * @param t reference to object, which must be zeroed
- */
-template <class T>
-static inline void SecureZero(T& t) noexcept {
- SecureZero((void*)&t, sizeof(t));
-}
-
+/**
+ * Securely zero memory (compiler does not optimize this out)
+ *
+ * @param pointer void pointer to start of memory block to be zeroed
+ * @param count size of memory block to be zeroed (in bytes)
+ */
+void SecureZero(void* pointer, size_t count) noexcept;
+
+/**
+ * Securely zero memory of given object (compiler does not optimize this out)
+ *
+ * @param t reference to object, which must be zeroed
+ */
+template <class T>
+static inline void SecureZero(T& t) noexcept {
+ SecureZero((void*)&t, sizeof(t));
+}
+
namespace NSwapCheck {
Y_HAS_MEMBER(swap);
Y_HAS_MEMBER(Swap);
@@ -111,18 +111,18 @@ struct TNullTmpl {
};
using TNull = TNullTmpl<0>;
-
-/*
- * Class for zero-initialize padding bytes in derived classes
- */
-template <typename TDerived>
-class TZeroInit {
-protected:
- TZeroInit() {
- // Actually, safe because this as TDerived is not initialized yet.
- Zero(*static_cast<TDerived*>(this));
- }
-};
+
+/*
+ * Class for zero-initialize padding bytes in derived classes
+ */
+template <typename TDerived>
+class TZeroInit {
+protected:
+ TZeroInit() {
+ // Actually, safe because this as TDerived is not initialized yet.
+ Zero(*static_cast<TDerived*>(this));
+ }
+};
struct TIdentity {
template <class T>