From b4183cbe445a58d6f9f98f9c22ffb2a296c1c4cd Mon Sep 17 00:00:00 2001 From: cryptocode Date: Sun, 8 Apr 2018 14:11:54 +0200 Subject: [PATCH] Remove some unused captures and locals, and constructor initialization list reordering --- rai/blockstore.cpp | 1 - rai/core_test/network.cpp | 2 +- rai/core_test/node.cpp | 2 +- rai/core_test/wallet.cpp | 1 - rai/node/bootstrap.cpp | 8 ++++---- rai/node/rpc.cpp | 2 +- rai/node/wallet.cpp | 2 +- rai/qt/qt.cpp | 2 +- rai/rai_node/entry.cpp | 1 - 9 files changed, 9 insertions(+), 12 deletions(-) diff --git a/rai/blockstore.cpp b/rai/blockstore.cpp index b6d4769c00..0b841827db 100644 --- a/rai/blockstore.cpp +++ b/rai/blockstore.cpp @@ -410,7 +410,6 @@ void rai::block_store::upgrade_v4_to_v5 (MDB_txn * transaction_a) version_put (transaction_a, 5); for (auto i (latest_begin (transaction_a)), n (latest_end ()); i != n; ++i) { - rai::account account (i->first.uint256 ()); rai::account_info_v5 info (i->second); rai::block_hash successor (0); auto block (block_get (transaction_a, info.head)); diff --git a/rai/core_test/network.cpp b/rai/core_test/network.cpp index 37d113c9e6..6a465f1383 100644 --- a/rai/core_test/network.cpp +++ b/rai/core_test/network.cpp @@ -889,7 +889,7 @@ TEST (network, ipv6_bind_send_ipv4) std::array bytes2; auto finish2 (false); rai::endpoint endpoint4; - socket2.async_receive_from (boost::asio::buffer (bytes2.data (), bytes2.size ()), endpoint4, [&finish2](boost::system::error_code const & error, size_t size_a) { + socket2.async_receive_from (boost::asio::buffer (bytes2.data (), bytes2.size ()), endpoint4, [](boost::system::error_code const & error, size_t size_a) { ASSERT_FALSE (!error); ASSERT_EQ (16, size_a); }); diff --git a/rai/core_test/node.cpp b/rai/core_test/node.cpp index df4191b2bb..fa35f223d1 100644 --- a/rai/core_test/node.cpp +++ b/rai/core_test/node.cpp @@ -1417,7 +1417,7 @@ TEST (node, balance_observer) auto & node1 (*system.nodes[0]); std::atomic balances (0); rai::keypair key; - node1.observers.account_balance.add ([&node1, &key, &balances](rai::account const & account_a, bool is_pending) { + node1.observers.account_balance.add ([&key, &balances](rai::account const & account_a, bool is_pending) { if (key.pub == account_a && is_pending) { balances++; diff --git a/rai/core_test/wallet.cpp b/rai/core_test/wallet.cpp index 3a752ea1a6..b5ed11ba47 100644 --- a/rai/core_test/wallet.cpp +++ b/rai/core_test/wallet.cpp @@ -953,7 +953,6 @@ TEST (wallet, password_race_corrupt_seed) runner.join (); { rai::transaction transaction (wallet->store.environment, nullptr, true); - bool ok = false; if (!wallet->store.attempt_password (transaction, "1234")) { rai::raw_key seed_now; diff --git a/rai/node/bootstrap.cpp b/rai/node/bootstrap.cpp index 8dcd5e0f4f..a500c99bc7 100644 --- a/rai/node/bootstrap.cpp +++ b/rai/node/bootstrap.cpp @@ -174,8 +174,8 @@ endpoint (endpoint_a), timeout (node_a->service), block_count (0), pending_stop (false), -hard_stop (false), -start_time (std::chrono::steady_clock::now ()) +start_time (std::chrono::steady_clock::now ()), +hard_stop (false) { ++attempt->connections; } @@ -797,8 +797,8 @@ connections (0), pulling (0), node (node_a), account_count (0), -stopped (false), -total_blocks (0) +total_blocks (0), +stopped (false) { BOOST_LOG (node->log) << "Starting bootstrap attempt"; node->bootstrap_initiator.notify_listeners (true); diff --git a/rai/node/rpc.cpp b/rai/node/rpc.cpp index 24f865939c..c05e9d4224 100644 --- a/rai/node/rpc.cpp +++ b/rai/node/rpc.cpp @@ -1606,8 +1606,8 @@ class history_visitor : public rai::block_visitor { public: history_visitor (rai::rpc_handler & handler_a, bool raw_a, rai::transaction & transaction_a, boost::property_tree::ptree & tree_a, rai::block_hash const & hash_a) : - raw (raw_a), handler (handler_a), + raw (raw_a), transaction (transaction_a), tree (tree_a), hash (hash_a) diff --git a/rai/node/wallet.cpp b/rai/node/wallet.cpp index 0ea60a7f8a..55d84fb1c9 100644 --- a/rai/node/wallet.cpp +++ b/rai/node/wallet.cpp @@ -1079,7 +1079,7 @@ bool rai::wallet::should_generate_state_block (MDB_txn * transaction_a, rai::blo bool rai::wallet::change_sync (rai::account const & source_a, rai::account const & representative_a) { std::promise result; - change_async (source_a, representative_a, [this, source_a, representative_a, &result](std::shared_ptr block_a) { + change_async (source_a, representative_a, [&result](std::shared_ptr block_a) { result.set_value (block_a == nullptr); }, true); diff --git a/rai/qt/qt.cpp b/rai/qt/qt.cpp index 8544ccd233..57e77b0181 100644 --- a/rai/qt/qt.cpp +++ b/rai/qt/qt.cpp @@ -116,8 +116,8 @@ void rai_qt::self_pane::refresh_balance () rai_qt::accounts::accounts (rai_qt::wallet & wallet_a) : window (new QWidget), -layout (new QVBoxLayout), wallet_balance_label (new QLabel), +layout (new QVBoxLayout), model (new QStandardItemModel), view (new QTableView), use_account (new QPushButton ("Use account")), diff --git a/rai/rai_node/entry.cpp b/rai/rai_node/entry.cpp index f480a68880..61e0481ec0 100644 --- a/rai/rai_node/entry.cpp +++ b/rai/rai_node/entry.cpp @@ -222,7 +222,6 @@ int main (int argc, char * const * argv) std::map calculated; for (auto i (node.node->store.latest_begin (transaction)), n (node.node->store.latest_end ()); i != n; ++i) { - rai::account account (i->first.uint256 ()); rai::account_info info (i->second); rai::block_hash rep_block (node.node->ledger.representative_calculated (transaction, info.head)); std::unique_ptr block (node.node->store.block_get (transaction, rep_block));