Skip to content

Commit 365539c

Browse files
committed
refactor: init vectors via std::{begin,end} to avoid pointer arithmetic
1 parent 63d4ee1 commit 365539c

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/bench/data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace benchmark {
88
namespace data {
99

1010
#include <bench/data/block413567.raw.h>
11-
const std::vector<uint8_t> block413567{block413567_raw, block413567_raw + sizeof(block413567_raw) / sizeof(block413567_raw[0])};
11+
const std::vector<uint8_t> block413567{std::begin(block413567_raw), std::end(block413567_raw)};
1212

1313
} // namespace data
1414
} // namespace benchmark

src/chainparams.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <hash.h> // for signet block challenge hash
1111
#include <tinyformat.h>
1212
#include <util/system.h>
13-
#include <util/strencodings.h>
1413
#include <versionbitsinfo.h>
1514

1615
#include <assert.h>
@@ -136,7 +135,7 @@ class CMainParams : public CChainParams {
136135

137136
bech32_hrp = "bc";
138137

139-
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
138+
vFixedSeeds = std::vector<SeedSpec6>(std::begin(pnSeed6_main), std::end(pnSeed6_main));
140139

141140
fDefaultConsistencyChecks = false;
142141
fRequireStandard = true;
@@ -237,7 +236,7 @@ class CTestNetParams : public CChainParams {
237236

238237
bech32_hrp = "tb";
239238

240-
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
239+
vFixedSeeds = std::vector<SeedSpec6>(std::begin(pnSeed6_test), std::end(pnSeed6_test));
241240

242241
fDefaultConsistencyChecks = false;
243242
fRequireStandard = false;

src/protocol.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <protocol.h>
77

8-
#include <util/strencodings.h>
98
#include <util/system.h>
109

1110
static std::atomic<bool> g_initial_block_download_completed(false);
@@ -86,7 +85,7 @@ const static std::string allNetMessageTypes[] = {
8685
NetMsgType::CFCHECKPT,
8786
NetMsgType::WTXIDRELAY,
8887
};
89-
const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes+ARRAYLEN(allNetMessageTypes));
88+
const static std::vector<std::string> allNetMessageTypesVec(std::begin(allNetMessageTypes), std::end(allNetMessageTypes));
9089

9190
CMessageHeader::CMessageHeader()
9291
{

0 commit comments

Comments
 (0)