summaryrefslogtreecommitdiff
path: root/core/templates
diff options
context:
space:
mode:
authorRafał Mikrut <mikrutrafal@protonmail.com>2020-11-23 17:38:46 +0100
committerRafał Mikrut <mikrutrafal@protonmail.com>2020-11-23 17:38:46 +0100
commit7bd03b718871137740c6bf074e984bba8dc113c3 (patch)
treec83a11a1ddae811a0ac2f7246f423678de2a106e /core/templates
parent18023cc3ede6fd84842db77019085c383e807016 (diff)
Initialize class/struct variables with default values in core/ and drivers/
Diffstat (limited to 'core/templates')
-rw-r--r--core/templates/hash_map.h2
-rw-r--r--core/templates/list.h6
-rw-r--r--core/templates/safe_refcount.h2
-rw-r--r--core/templates/set.h2
-rw-r--r--core/templates/thread_work_pool.h4
5 files changed, 8 insertions, 8 deletions
diff --git a/core/templates/hash_map.h b/core/templates/hash_map.h
index f6b889015a..e1ba381595 100644
--- a/core/templates/hash_map.h
+++ b/core/templates/hash_map.h
@@ -73,7 +73,7 @@ public:
private:
friend class HashMap;
- uint32_t hash;
+ uint32_t hash = 0;
Element *next = nullptr;
Element() {}
Pair pair;
diff --git a/core/templates/list.h b/core/templates/list.h
index d745066e4c..8e14aaa90d 100644
--- a/core/templates/list.h
+++ b/core/templates/list.h
@@ -137,9 +137,9 @@ public:
private:
struct _Data {
- Element *first;
- Element *last;
- int size_cache;
+ Element *first = nullptr;
+ Element *last = nullptr;
+ int size_cache = 0;
bool erase(const Element *p_I) {
ERR_FAIL_COND_V(!p_I, false);
diff --git a/core/templates/safe_refcount.h b/core/templates/safe_refcount.h
index dc4e62354a..6b08b876f8 100644
--- a/core/templates/safe_refcount.h
+++ b/core/templates/safe_refcount.h
@@ -165,7 +165,7 @@ uint64_t atomic_exchange_if_greater(volatile uint64_t *pw, volatile uint64_t val
#endif
struct SafeRefCount {
- uint32_t count;
+ uint32_t count = 0;
public:
// destroy() is called when weak_count_ drops to zero.
diff --git a/core/templates/set.h b/core/templates/set.h
index 1bc0a3f41e..d0ac71a710 100644
--- a/core/templates/set.h
+++ b/core/templates/set.h
@@ -80,7 +80,7 @@ public:
private:
struct _Data {
Element *_root = nullptr;
- Element *_nil;
+ Element *_nil = nullptr;
int size_cache = 0;
_FORCE_INLINE_ _Data() {
diff --git a/core/templates/thread_work_pool.h b/core/templates/thread_work_pool.h
index 661060aa3f..e083cdcb24 100644
--- a/core/templates/thread_work_pool.h
+++ b/core/templates/thread_work_pool.h
@@ -41,8 +41,8 @@ class ThreadWorkPool {
std::atomic<uint32_t> index;
struct BaseWork {
- std::atomic<uint32_t> *index;
- uint32_t max_elements;
+ std::atomic<uint32_t> *index = nullptr;
+ uint32_t max_elements = 0;
virtual void work() = 0;
virtual ~BaseWork() = default;
};