From b21083db1f6c5f58e4c2f2b41cf4631270679a5b Mon Sep 17 00:00:00 2001 From: sowle Date: Fri, 16 Feb 2024 03:56:42 +0100 Subject: [PATCH] fix loop variable type here and there (performance) --- src/currency_core/blockchain_storage.cpp | 8 ++++---- src/currency_core/currency_format_utils.cpp | 2 +- src/rpc/core_rpc_server.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index e4e4824e..04fd1e1a 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -5818,7 +5818,7 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti }; //inputs - for (const auto in : tx.vin) + for (const auto& in : tx.vin) { if (!var_is_after_hardfork_1_zone && !is_allowed_before_hardfork1(in)) return false; @@ -5832,7 +5832,7 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti return false; } //outputs - for (const auto out : tx.vout) + for (const auto& out : tx.vout) { if (!var_is_after_hardfork_1_zone && !is_allowed_before_hardfork1(out)) return false; @@ -5848,7 +5848,7 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti size_t count_ado = 0; //extra - for (const auto el : tx.extra) + for (const auto& el : tx.extra) { if (el.type() == typeid(asset_descriptor_operation)) count_ado++; @@ -5863,7 +5863,7 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti } //attachments - for (const auto el : tx.attachment) + for (const auto& el : tx.attachment) { if (!var_is_after_hardfork_2_zone && !is_allowed_before_hardfork2(el)) return false; diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index 9b250d89..6585c049 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -2506,7 +2506,7 @@ namespace currency tx.attachment.insert(tx.attachment.end(), attachments_local.begin(), attachments_local.end()); tx.extra.insert(tx.extra.end(), extra_local.begin(), extra_local.end()); - for (const auto in : tx.vin) + for (const auto& in : tx.vin) { if (in.type() == typeid(txin_zc_input)) { diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index ec015d6b..f1460e35 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -679,7 +679,7 @@ namespace currency { std::list al_list; m_core.get_tx_pool().get_aliases_from_tx_pool(al_list); - for (const auto a : al_list) + for (const auto& a : al_list) { res.aliases_que.push_back(alias_info_to_rpc_alias_info(a)); }