Skip to content

Commit c8734e2

Browse files
Merge #6194: refactor: initialize variables in the header instead
3e788ed fmt: run `clang-format` (pasta) cc3b63d refactor: initialize variables in the header instead (pasta) Pull request description: ## Issue being fixed or feature implemented Don't initialize via initializer lists when avoidable ## What was done? Initialize in the header ## How Has This Been Tested? building ## Breaking Changes None ## Checklist: - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 3e788ed Tree-SHA512: 568adae0a4af675d7ba34356ee9f62374ec1dd1be7515231ee7cae41fc21a3d72b0e9f6d8ab2f9ba10aa70e967e1358d065931a23cffcca0f0801260151bf942
2 parents f1e8452 + 3e788ed commit c8734e2

File tree

2 files changed

+13
-38
lines changed

2 files changed

+13
-38
lines changed

src/governance/object.cpp

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,16 @@
2222

2323
#include <string>
2424

25-
CGovernanceObject::CGovernanceObject() :
26-
cs(),
27-
m_obj{},
28-
nDeletionTime(0),
29-
fCachedLocalValidity(false),
30-
strLocalValidityError(),
31-
fCachedFunding(false),
32-
fCachedValid(true),
33-
fCachedDelete(false),
34-
fCachedEndorsed(false),
35-
fDirtyCache(true),
36-
fExpired(false),
37-
fUnparsable(false),
38-
mapCurrentMNVotes(),
39-
fileVotes()
25+
CGovernanceObject::CGovernanceObject()
4026
{
4127
// PARSE JSON DATA STORAGE (VCHDATA)
4228
LoadData();
4329
}
4430

45-
CGovernanceObject::CGovernanceObject(const uint256& nHashParentIn, int nRevisionIn, int64_t nTimeIn, const uint256& nCollateralHashIn, const std::string& strDataHexIn) :
31+
CGovernanceObject::CGovernanceObject(const uint256& nHashParentIn, int nRevisionIn, int64_t nTimeIn,
32+
const uint256& nCollateralHashIn, const std::string& strDataHexIn) :
4633
cs(),
47-
m_obj{nHashParentIn, nRevisionIn, nTimeIn, nCollateralHashIn, strDataHexIn},
48-
nDeletionTime(0),
49-
fCachedLocalValidity(false),
50-
strLocalValidityError(),
51-
fCachedFunding(false),
52-
fCachedValid(true),
53-
fCachedDelete(false),
54-
fCachedEndorsed(false),
55-
fDirtyCache(true),
56-
fExpired(false),
57-
fUnparsable(false),
58-
mapCurrentMNVotes(),
59-
fileVotes()
34+
m_obj{nHashParentIn, nRevisionIn, nTimeIn, nCollateralHashIn, strDataHexIn}
6035
{
6136
// PARSE JSON DATA STORAGE (VCHDATA)
6237
LoadData();

src/governance/object.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,37 +103,37 @@ class CGovernanceObject
103103
Governance::Object m_obj;
104104

105105
/// time this object was marked for deletion
106-
int64_t nDeletionTime;
106+
int64_t nDeletionTime{0};
107107

108108

109109
/// is valid by blockchain
110-
bool fCachedLocalValidity;
110+
bool fCachedLocalValidity{false};
111111
std::string strLocalValidityError;
112112

113113
// VARIOUS FLAGS FOR OBJECT / SET VIA MASTERNODE VOTING
114114

115115
/// true == minimum network support has been reached for this object to be funded (doesn't mean it will for sure though)
116-
bool fCachedFunding;
116+
bool fCachedFunding{false};
117117

118118
/// true == minimum network has been reached flagging this object as a valid and understood governance object (e.g, the serialized data is correct format, etc)
119-
bool fCachedValid;
119+
bool fCachedValid{true};
120120

121121
/// true == minimum network support has been reached saying this object should be deleted from the system entirely
122-
bool fCachedDelete;
122+
bool fCachedDelete{false};
123123

124124
/** true == minimum network support has been reached flagging this object as endorsed by an elected representative body
125125
* (e.g. business review board / technical review board /etc)
126126
*/
127-
bool fCachedEndorsed;
127+
bool fCachedEndorsed{false};
128128

129129
/// object was updated and cached values should be updated soon
130-
bool fDirtyCache;
130+
bool fDirtyCache{true};
131131

132132
/// Object is no longer of interest
133-
bool fExpired;
133+
bool fExpired{false};
134134

135135
/// Failed to parse object data
136-
bool fUnparsable;
136+
bool fUnparsable{false};
137137

138138
vote_m_t mapCurrentMNVotes;
139139

0 commit comments

Comments
 (0)