Skip to content

Commit 42bd1bb

Browse files
MarcoFalkevijaydasmp
authored andcommitted
Merge bitcoin#26705: clang-tidy: Fix modernize-use-default-member-init in headers and force to check all headers
b0e9169 clang-tidy: Force to check all headers (Hennadii Stepanov) 96ee992 clang-tidy: Fix `modernize-use-default-member-init` in headers (Hennadii Stepanov) Pull request description: This PR: - fixes the only [remained](bitcoin#26705 (comment)) check in headers, i.e., `modernize-use-default-member-init` - forces `clang-tidy` check all headers Closes bitcoin#26703. ACKs for top commit: MarcoFalke: review ACK b0e9169 🍹 Tree-SHA512: 4d33fe873094914541ae81968cdb4e7a7a01b3fdd4f25bc6daa8a53f45dab80565a5b3607ddc338f122369ca5a0a2d0d09c8e78cabe1beb6bd50c115bc5c5210
1 parent 37359ae commit 42bd1bb

31 files changed

+66
-71
lines changed

src/crypto/ripemd160.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void Transform(uint32_t* s, const unsigned char* chunk)
239239

240240
////// RIPEMD160
241241

242-
CRIPEMD160::CRIPEMD160() : bytes(0)
242+
CRIPEMD160::CRIPEMD160()
243243
{
244244
ripemd160::Initialize(s);
245245
}

src/crypto/ripemd160.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CRIPEMD160
1414
private:
1515
uint32_t s[5];
1616
unsigned char buf[64];
17-
uint64_t bytes;
17+
uint64_t bytes{0};
1818

1919
public:
2020
static const size_t OUTPUT_SIZE = 20;

src/crypto/sha1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void Transform(uint32_t* s, const unsigned char* chunk)
146146

147147
////// SHA1
148148

149-
CSHA1::CSHA1() : bytes(0)
149+
CSHA1::CSHA1()
150150
{
151151
sha1::Initialize(s);
152152
}

src/crypto/sha1.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CSHA1
1414
private:
1515
uint32_t s[5];
1616
unsigned char buf[64];
17-
uint64_t bytes;
17+
uint64_t bytes{0};
1818

1919
public:
2020
static const size_t OUTPUT_SIZE = 20;

src/crypto/sha256.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem
690690

691691
////// SHA-256
692692

693-
CSHA256::CSHA256() : bytes(0)
693+
CSHA256::CSHA256()
694694
{
695695
sha256::Initialize(s);
696696
}

src/crypto/sha256.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CSHA256
1515
private:
1616
uint32_t s[8];
1717
unsigned char buf[64];
18-
uint64_t bytes;
18+
uint64_t bytes{0};
1919

2020
public:
2121
static const size_t OUTPUT_SIZE = 32;

src/crypto/sha512.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void Transform(uint64_t* s, const unsigned char* chunk)
151151

152152
////// SHA-512
153153

154-
CSHA512::CSHA512() : bytes(0)
154+
CSHA512::CSHA512()
155155
{
156156
sha512::Initialize(s);
157157
}

src/crypto/sha512.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CSHA512
1414
private:
1515
uint64_t s[8];
1616
unsigned char buf[128];
17-
uint64_t bytes;
17+
uint64_t bytes{0};
1818

1919
public:
2020
static constexpr size_t OUTPUT_SIZE = 64;

src/cuckoocache.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class cache
164164
std::vector<Element> table;
165165

166166
/** size stores the total available slots in the hash table */
167-
uint32_t size;
167+
uint32_t size{0};
168168

169169
/** The bit_packed_atomic_flags array is marked mutable because we want
170170
* garbage collection to be allowed to occur from const methods */
@@ -181,7 +181,7 @@ class cache
181181
* decremented on insert and reset to the new number of inserts which would
182182
* cause the epoch to reach epoch_size when it reaches zero.
183183
*/
184-
uint32_t epoch_heuristic_counter;
184+
uint32_t epoch_heuristic_counter{0};
185185

186186
/** epoch_size is set to be the number of elements supposed to be in a
187187
* epoch. When the number of non-erased elements in an epoch
@@ -191,12 +191,12 @@ class cache
191191
* one "dead" which has been erased, one "dying" which has been marked to be
192192
* erased next, and one "living" which new inserts add to.
193193
*/
194-
uint32_t epoch_size;
194+
uint32_t epoch_size{0};
195195

196196
/** depth_limit determines how many elements insert should try to replace.
197197
* Should be set to log2(n).
198198
*/
199-
uint8_t depth_limit;
199+
uint8_t depth_limit{0};
200200

201201
/** hash_function is a const instance of the hash function. It cannot be
202202
* static or initialized at call time as it may have internal state (such as
@@ -320,8 +320,7 @@ class cache
320320
/** You must always construct a cache with some elements via a subsequent
321321
* call to setup or setup_bytes, otherwise operations may segfault.
322322
*/
323-
cache() : table(), size(), collection_flags(0), epoch_flags(),
324-
epoch_heuristic_counter(), epoch_size(), depth_limit(0), hash_function()
323+
cache() : table(), collection_flags(0), epoch_flags(), hash_function()
325324
{
326325
}
327326

src/dbwrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ class CDBBatch
5959
CDataStream ssKey;
6060
CDataStream ssValue;
6161

62-
size_t size_estimate;
62+
size_t size_estimate{0};
6363

6464
public:
6565
/**
6666
* @param[in] _parent CDBWrapper that this batch is to be submitted to
6767
*/
68-
explicit CDBBatch(const CDBWrapper &_parent) : parent(_parent), ssKey(SER_DISK, CLIENT_VERSION), ssValue(SER_DISK, CLIENT_VERSION), size_estimate(0) { };
68+
explicit CDBBatch(const CDBWrapper &_parent) : parent(_parent), ssKey(SER_DISK, CLIENT_VERSION), ssValue(SER_DISK, CLIENT_VERSION) { };
6969

7070
void Clear()
7171
{

0 commit comments

Comments
 (0)