mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #15109: refactor: Use C++11 default member initializers
fa2510d5c1 Use C++11 default member initializers (MarcoFalke)
Pull request description:
Changes:
* Remove unused constructors that leave some members uninitialized
* Remove manual initialization in each constructor and prefer C++11 default member initializers
This is not a stylistic change, but a change that avoids bugs such as:
* fix uninitialized read when stringifying an addrLocal #14728
* qt: Initialize members in WalletModel #12426
* net: correctly initialize nMinPingUsecTime #6636
* ...
Tree-SHA512: 0f896f3b9fcc464d5fc7525f7c86343ef9ce9fb13425fbc68e9a9728fd8710c2b4e2fd039ee08279ea41ff20fd92b7185cf5cca95a0bcb6a5340a1e6f03cae6b
This commit is contained in:
16
src/net.h
16
src/net.h
@@ -404,15 +404,15 @@ private:
|
||||
// whitelisted (as well as those connecting to whitelisted binds).
|
||||
std::vector<CSubNet> vWhitelistedRange;
|
||||
|
||||
unsigned int nSendBufferMaxSize;
|
||||
unsigned int nReceiveFloodSize;
|
||||
unsigned int nSendBufferMaxSize{0};
|
||||
unsigned int nReceiveFloodSize{0};
|
||||
|
||||
std::vector<ListenSocket> vhListenSocket;
|
||||
std::atomic<bool> fNetworkActive;
|
||||
std::atomic<bool> fNetworkActive{true};
|
||||
banmap_t setBanned GUARDED_BY(cs_setBanned);
|
||||
CCriticalSection cs_setBanned;
|
||||
bool setBannedIsDirty GUARDED_BY(cs_setBanned);
|
||||
bool fAddressesInitialized;
|
||||
bool setBannedIsDirty GUARDED_BY(cs_setBanned){false};
|
||||
bool fAddressesInitialized{false};
|
||||
CAddrMan addrman;
|
||||
std::deque<std::string> vOneShots GUARDED_BY(cs_vOneShots);
|
||||
CCriticalSection cs_vOneShots;
|
||||
@@ -421,8 +421,8 @@ private:
|
||||
std::vector<CNode*> vNodes;
|
||||
std::list<CNode*> vNodesDisconnected;
|
||||
mutable CCriticalSection cs_vNodes;
|
||||
std::atomic<NodeId> nLastNodeId;
|
||||
unsigned int nPrevNodeCount;
|
||||
std::atomic<NodeId> nLastNodeId{0};
|
||||
unsigned int nPrevNodeCount{0};
|
||||
|
||||
/** Services this instance offers */
|
||||
ServiceFlags nLocalServices;
|
||||
@@ -446,7 +446,7 @@ private:
|
||||
|
||||
std::condition_variable condMsgProc;
|
||||
Mutex mutexMsgProc;
|
||||
std::atomic<bool> flagInterruptMsgProc;
|
||||
std::atomic<bool> flagInterruptMsgProc{false};
|
||||
|
||||
CThreadInterrupt interruptNet;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user