Skip to content

Commit a774c7a

Browse files
committed
refactor: Fix remaining clang-tidy performance-inefficient-vector errors
1 parent 2638fdb commit a774c7a

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

src/rpc/output_script.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ static RPCHelpMan createmultisig()
123123
// Get the public keys
124124
const UniValue& keys = request.params[1].get_array();
125125
std::vector<CPubKey> pubkeys;
126+
pubkeys.reserve(keys.size());
126127
for (unsigned int i = 0; i < keys.size(); ++i) {
127128
pubkeys.push_back(HexToPubKey(keys[i].get_str()));
128129
}

src/test/checkqueue_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueueControl_Locks)
360360
auto queue = std::make_unique<Standard_Queue>(QUEUE_BATCH_SIZE, SCRIPT_CHECK_THREADS);
361361
{
362362
std::vector<std::thread> tg;
363+
tg.reserve(3);
363364
std::atomic<int> nThreads {0};
364365
std::atomic<int> fails {0};
365366
for (size_t i = 0; i < 3; ++i) {

src/test/cuckoocache_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ void test_cache_erase_parallel(size_t megabytes)
224224
/** Spin up 3 threads to run contains with erase.
225225
*/
226226
std::vector<std::thread> threads;
227+
threads.reserve(3);
227228
/** Erase the first quarter */
228229
for (uint32_t x = 0; x < 3; ++x)
229230
/** Each thread is emplaced with x copy-by-value

src/test/rpc_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ BOOST_AUTO_TEST_CASE(rpc_getblockstats_calculate_percentiles_by_weight)
428428
{
429429
int64_t total_weight = 200;
430430
std::vector<std::pair<CAmount, int64_t>> feerates;
431+
feerates.reserve(200);
431432
CAmount result[NUM_GETBLOCKSTATS_PERCENTILES] = { 0 };
432433

433434
for (int64_t i = 0; i < 100; i++) {

0 commit comments

Comments
 (0)