From 72f330320bd4e40c29a0c40d56bb9cba339dce12 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Wed, 20 Dec 2023 21:16:01 +0200 Subject: [PATCH] [#3119] replace const auto with auto const --- src/bin/dhcp4/dhcp4_srv.cc | 14 ++--- src/bin/dhcp4/tests/config_parser_unittest.cc | 2 +- src/bin/dhcp4/tests/dhcp4_srv_unittest.cc | 2 +- src/bin/dhcp4/tests/hooks_unittest.cc | 4 +- src/bin/dhcp6/dhcp6_srv.cc | 28 ++++----- src/bin/dhcp6/tests/config_parser_unittest.cc | 2 +- src/bin/dhcp6/tests/dhcp6_client.cc | 8 +-- src/bin/dhcp6/tests/dhcp6_srv_unittest.cc | 2 +- src/bin/dhcp6/tests/hooks_unittest.cc | 2 +- src/bin/perfdhcp/test_control.cc | 2 +- src/hooks/dhcp/flex_option/flex_option.h | 2 +- .../high_availability/ha_config_parser.cc | 6 +- .../dhcp/high_availability/ha_service.cc | 2 +- .../dhcp/high_availability/query_filter.cc | 4 +- .../tests/ha_relationship_mapper_unittest.cc | 2 +- src/hooks/dhcp/lease_cmds/lease_cmds.cc | 58 +++++++++---------- src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc | 18 +++--- src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc | 22 +++---- src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc | 4 +- src/hooks/dhcp/mysql_cb/mysql_cb_impl.h | 2 +- src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc | 16 ++--- src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc | 20 +++---- src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc | 4 +- src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h | 2 +- src/hooks/dhcp/stat_cmds/stat_cmds.cc | 4 +- src/lib/asiolink/io_service_thread_pool.cc | 2 +- .../asiolink/tests/addr_utilities_unittest.cc | 4 +- src/lib/cc/command_interpreter.cc | 2 +- src/lib/cc/data.cc | 26 ++++----- src/lib/cc/simple_parser.cc | 4 +- src/lib/cc/stamped_element.cc | 2 +- .../config_backend/base_config_backend_pool.h | 14 ++--- .../tests/config_backend_mgr_unittest.cc | 6 +- src/lib/d2srv/d2_stats.cc | 4 +- src/lib/d2srv/d2_tsig_key.cc | 6 +- src/lib/d2srv/testutils/stats_test_utils.cc | 2 +- src/lib/database/database_connection.cc | 2 +- src/lib/database/dbaccess_parser.cc | 2 +- src/lib/database/server_selector.cc | 2 +- .../database/tests/audit_entry_unittest.cc | 8 +-- src/lib/dhcp/iface_mgr.cc | 4 +- src/lib/dhcp/libdhcp++.cc | 4 +- src/lib/dhcp/option4_dnr.cc | 2 +- src/lib/dhcp/option6_dnr.cc | 2 +- src/lib/dhcp/pkt.cc | 6 +- src/lib/dhcp/pkt4.cc | 4 +- src/lib/dhcp/pkt6.cc | 12 ++-- src/lib/dhcpsrv/alloc_engine.cc | 54 ++++++++--------- src/lib/dhcpsrv/cb_ctl_dhcp.h | 4 +- src/lib/dhcpsrv/cb_ctl_dhcp4.cc | 2 +- src/lib/dhcpsrv/cb_ctl_dhcp6.cc | 2 +- src/lib/dhcpsrv/cfg_hosts.cc | 10 ++-- src/lib/dhcpsrv/cfg_option.cc | 4 +- src/lib/dhcpsrv/cfg_shared_networks.cc | 2 +- src/lib/dhcpsrv/cfg_shared_networks.h | 6 +- src/lib/dhcpsrv/cfg_subnets4.cc | 12 ++-- src/lib/dhcpsrv/cfg_subnets6.cc | 16 ++--- src/lib/dhcpsrv/iterative_allocator.cc | 4 +- src/lib/dhcpsrv/lease_mgr.cc | 6 +- src/lib/dhcpsrv/memfile_lease_mgr.cc | 6 +- src/lib/dhcpsrv/mysql_lease_mgr.cc | 2 +- .../parsers/client_class_def_parser.cc | 2 +- src/lib/dhcpsrv/parsers/dhcp_parsers.cc | 2 +- src/lib/dhcpsrv/pgsql_lease_mgr.cc | 2 +- src/lib/dhcpsrv/random_allocator.cc | 4 +- src/lib/dhcpsrv/shared_network.cc | 6 +- src/lib/dhcpsrv/srv_config.cc | 2 +- src/lib/dhcpsrv/subnet.cc | 30 +++++----- src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc | 4 +- .../tests/memfile_lease_mgr_unittest.cc | 2 +- .../dhcpsrv/tests/shared_network_unittest.cc | 4 +- .../testutils/generic_backend_unittest.cc | 4 +- .../testutils/generic_cb_dhcp4_unittest.cc | 4 +- .../testutils/generic_cb_dhcp6_unittest.cc | 4 +- .../generic_host_data_source_unittest.cc | 2 +- .../testutils/memory_host_data_source.cc | 8 +-- .../testutils/test_config_backend_dhcp4.cc | 24 ++++---- .../testutils/test_config_backend_dhcp6.cc | 24 ++++---- src/lib/http/basic_auth_config.cc | 2 +- src/lib/http/tests/client_mt_unittests.cc | 6 +- .../pgsql/tests/pgsql_connection_unittest.cc | 4 +- src/lib/process/cb_ctl_base.h | 6 +- src/lib/process/redact_config.cc | 2 +- .../process/tests/cb_ctl_base_unittests.cc | 2 +- src/lib/stats/context.cc | 2 +- src/lib/stats/testutils/stats_test_utils.h | 2 +- src/lib/tcp/tcp_connection_pool.cc | 4 +- src/lib/testutils/gtest_utils.h | 4 +- src/lib/util/multi_threading_mgr.cc | 6 +- src/lib/util/strutil.h | 4 +- src/lib/util/tests/thread_pool_unittest.cc | 4 +- src/lib/util/thread_pool.h | 4 +- .../yang/tests/translator_utils_unittests.cc | 2 +- 93 files changed, 332 insertions(+), 332 deletions(-) diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 4761c91ba1..8edef2d542 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1495,7 +1495,7 @@ Dhcpv4Srv::processDhcp4Query(Pkt4Ptr& query, Pkt4Ptr& rsp, } if (parked_packet_limit) { - const auto& parking_lot = + auto const& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr(hook_label); if (parking_lot && (parking_lot->size() >= parked_packet_limit)) { @@ -3748,9 +3748,9 @@ Dhcpv4Srv::processRelease(Pkt4Ptr& release, AllocEngine::ClientContext4Ptr& cont StatsMgr::generateName("subnet", lease->subnet_id_, "assigned-addresses"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -3920,9 +3920,9 @@ Dhcpv4Srv::declineLease(const Lease4Ptr& lease, const Pkt4Ptr& decline, StatsMgr::generateName("subnet", lease->subnet_id_, "declined-addresses"), static_cast(1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -4021,9 +4021,9 @@ Dhcpv4Srv::serverDecline(hooks::CalloutHandlePtr& callout_handle, Pkt4Ptr& query static_cast(1)); } - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index bc19bbc20d..eb78dbbf76 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -764,7 +764,7 @@ public: checkSubnet(const CollectionType& col, std::string subnet, uint32_t t1, uint32_t t2, uint32_t valid, uint32_t min_valid = 0, uint32_t max_valid = 0) { - const auto& index = col.template get(); + auto const& index = col.template get(); auto subnet_it = index.find(subnet); if (subnet_it == index.cend()) { ADD_FAILURE() << "Unable to find expected subnet " << subnet; diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc index fc3e6ca5ef..28d150b343 100644 --- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc @@ -2995,7 +2995,7 @@ Dhcpv4SrvTest::checkConfigFiles() { string file = path + "/" + example; files.push_back(file); } - for (const auto& file : files) { + for (auto const& file : files) { string label("Checking configuration from file: "); label += file; SCOPED_TRACE(label); diff --git a/src/bin/dhcp4/tests/hooks_unittest.cc b/src/bin/dhcp4/tests/hooks_unittest.cc index 0973a74d5c..8ee1a8a3dc 100644 --- a/src/bin/dhcp4/tests/hooks_unittest.cc +++ b/src/bin/dhcp4/tests/hooks_unittest.cc @@ -3518,7 +3518,7 @@ TEST_F(HooksDhcpv4SrvTest, leases4ParkedPacketLimit) { ASSERT_FALSE(client.getContext().response_); // Verify we have a packet parked. - const auto& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("leases4_committed"); + auto const& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("leases4_committed"); ASSERT_TRUE(parking_lot); ASSERT_EQ(1, parking_lot->size()); @@ -3878,7 +3878,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4OfferParkedPacketLimit) { ASSERT_FALSE(client.getContext().response_); // Verify we have a packet parked. - const auto& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("lease4_offer"); + auto const& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("lease4_offer"); ASSERT_TRUE(parking_lot); ASSERT_EQ(1, parking_lot->size()); diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index ad4f94a940..a7e7379581 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -1153,7 +1153,7 @@ Dhcpv6Srv::processDhcp6Query(Pkt6Ptr& query, Pkt6Ptr& rsp) { } if (parked_packet_limit) { - const auto& parking_lot = ServerHooks::getServerHooks(). + auto const& parking_lot = ServerHooks::getServerHooks(). getParkingLotPtr("leases6_committed"); if (parking_lot && (parking_lot->size() >= parked_packet_limit)) { // We can't park it so we're going to throw it on the floor. @@ -1426,7 +1426,7 @@ Dhcpv6Srv::buildCfgOptionList(const Pkt6Ptr& question, // Secondly, pool specific options. Pools are defined within a subnet, so // if there is no subnet, there is nothing to do. if (ctx.subnet_) { - for (const auto& resource : ctx.allocated_resources_) { + for (auto const& resource : ctx.allocated_resources_) { PoolPtr pool = ctx.subnet_->getPool(resource.getPrefixLength() == 128 ? Lease::TYPE_NA : Lease::TYPE_PD, @@ -2019,7 +2019,7 @@ Dhcpv6Srv::assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer, // responses in answer message (ADVERTISE or REPLY). // // @todo: IA_TA once we implement support for temporary addresses. - for (const auto& opt : question->options_) { + for (auto const& opt : question->options_) { switch (opt.second->getType()) { case D6O_IA_NA: { OptionPtr answer_opt = assignIA_NA(question, ctx, @@ -3009,7 +3009,7 @@ Dhcpv6Srv::extendLeases(const Pkt6Ptr& query, Pkt6Ptr& reply, // Save the originally selected subnet. Subnet6Ptr orig_subnet = ctx.subnet_; - for (const auto& opt : query->options_) { + for (auto const& opt : query->options_) { switch (opt.second->getType()) { case D6O_IA_NA: { OptionPtr answer_opt = extendIA_NA(query, ctx, @@ -3061,7 +3061,7 @@ Dhcpv6Srv::releaseLeases(const Pkt6Ptr& release, Pkt6Ptr& reply, // handled properly. Therefore the releaseIA_NA and releaseIA_PD options // may turn the status code to some error, but can't turn it back to success. int general_status = STATUS_Success; - for (const auto& opt : release->options_) { + for (auto const& opt : release->options_) { Lease6Ptr old_lease; switch (opt.second->getType()) { case D6O_IA_NA: { @@ -3289,9 +3289,9 @@ Dhcpv6Srv::releaseIA_NA(const DuidPtr& duid, const Pkt6Ptr& query, StatsMgr::generateName("subnet", lease->subnet_id_, "assigned-nas"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_NA, lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_NA, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -3497,9 +3497,9 @@ Dhcpv6Srv::releaseIA_PD(const DuidPtr& duid, const Pkt6Ptr& query, StatsMgr::generateName("subnet", lease->subnet_id_, "assigned-pds"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_PD, lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_PD, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -3876,7 +3876,7 @@ Dhcpv6Srv::declineLeases(const Pkt6Ptr& decline, Pkt6Ptr& reply, // may turn the status code to some error, but can't turn it back to success. int general_status = STATUS_Success; - for (const auto& opt : decline->options_) { + for (auto const& opt : decline->options_) { switch (opt.second->getType()) { case D6O_IA_NA: { OptionPtr answer_opt = declineIA(decline, ctx.duid_, general_status, @@ -4125,9 +4125,9 @@ Dhcpv6Srv::declineLease(const Pkt6Ptr& decline, const Lease6Ptr lease, StatsMgr::generateName("subnet", lease->subnet_id_, "declined-addresses"), static_cast(1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_NA, lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_NA, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -4209,7 +4209,7 @@ Dhcpv6Srv::processDhcp4Query(const Pkt6Ptr& dhcp4_query) { void Dhcpv6Srv::classifyByVendor(const Pkt6Ptr& pkt) { OptionVendorClassPtr vclass; - for (const auto& opt : pkt->getOptions(D6O_VENDOR_CLASS)) { + for (auto const& opt : pkt->getOptions(D6O_VENDOR_CLASS)) { vclass = boost::dynamic_pointer_cast(opt.second); if (!vclass || vclass->getTuplesNum() == 0) { continue; @@ -4331,7 +4331,7 @@ Dhcpv6Srv::requiredClassify(const Pkt6Ptr& pkt, AllocEngine::ClientContext6& ctx } // And finish by pools - for (const auto& resource : ctx.allocated_resources_) { + for (auto const& resource : ctx.allocated_resources_) { PoolPtr pool = ctx.subnet_->getPool(resource.getPrefixLength() == 128 ? Lease::TYPE_NA : Lease::TYPE_PD, diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index a3fd0cd15d..ef08dbdd24 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -492,7 +492,7 @@ public: uint32_t t1, uint32_t t2, uint32_t pref, uint32_t valid, uint32_t min_pref = 0, uint32_t max_pref = 0, uint32_t min_valid = 0, uint32_t max_valid = 0) { - const auto& index = col.template get(); + auto const& index = col.template get(); auto subnet_it = index.find(subnet); if (subnet_it == index.cend()) { ADD_FAILURE() << "Unable to find expected subnet " << subnet; diff --git a/src/bin/dhcp6/tests/dhcp6_client.cc b/src/bin/dhcp6/tests/dhcp6_client.cc index c5954023b3..a797a9745d 100644 --- a/src/bin/dhcp6/tests/dhcp6_client.cc +++ b/src/bin/dhcp6/tests/dhcp6_client.cc @@ -144,7 +144,7 @@ Dhcp6Client::applyRcvdConfiguration(const Pkt6Ptr& reply, uint32_t state) { // Get all options in the reply message and pick IA_NA, IA_PD and // Status code. - for (const auto& opt : reply->options_) { + for (auto const& opt : reply->options_) { Option6IAPtr ia = boost::dynamic_pointer_cast(opt.second); if (!ia) { // This is not IA, so let's just store it. @@ -152,8 +152,8 @@ Dhcp6Client::applyRcvdConfiguration(const Pkt6Ptr& reply, uint32_t state) { continue; } - const auto& ia_opts = ia->getOptions(); - for (const auto& iter_ia_opt : ia_opts) { + auto const& ia_opts = ia->getOptions(); + for (auto const& iter_ia_opt : ia_opts) { OptionPtr ia_opt = iter_ia_opt.second; Lease6 lease; lease.type_ = (ia->getType() == D6O_IA_NA ? Lease::TYPE_NA : Lease::TYPE_PD); @@ -873,7 +873,7 @@ Dhcp6Client::getTeeTimes(const uint32_t iaid, uint32_t& t1, uint32_t& t2) const } // Get all options in the response message and pick IA_NA, IA_PD. - for (const auto& opt : context_.response_->options_) { + for (auto const& opt : context_.response_->options_) { Option6IAPtr ia = boost::dynamic_pointer_cast(opt.second); if (!ia) { // This is not IA, so let's just skip it. diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index 9b595874e3..656711af22 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc @@ -366,7 +366,7 @@ Dhcpv6SrvTest::checkConfigFiles() { string file = path + "/" + example; files.push_back(file); } - for (const auto& file : files) { + for (auto const& file : files) { string label("Checking configuration from file: "); label += file; SCOPED_TRACE(label); diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index d72464de6d..d87896eab3 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/src/bin/dhcp6/tests/hooks_unittest.cc @@ -5705,7 +5705,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6ParkedPacketLimit) { ASSERT_NO_THROW(configure(config, *srv_)); // Verify we have no packets parked. - const auto& parking_lot = ServerHooks::getServerHooks() + auto const& parking_lot = ServerHooks::getServerHooks() .getParkingLotPtr("leases6_committed"); ASSERT_TRUE(parking_lot); ASSERT_EQ(0, parking_lot->size()); diff --git a/src/bin/perfdhcp/test_control.cc b/src/bin/perfdhcp/test_control.cc index 47165552b7..29ef5a87f3 100644 --- a/src/bin/perfdhcp/test_control.cc +++ b/src/bin/perfdhcp/test_control.cc @@ -861,7 +861,7 @@ TestControl::address6Uniqueness(const Pkt6Ptr& pkt6, ExchangeType xchg_type) { std::set current; // addresses were already checked in validateIA // we can safely assume that those are correct - for (const auto& opt : pkt6->options_) { + for (auto const& opt : pkt6->options_) { switch (opt.second->getType()) { case D6O_IA_PD: { // add address and check if it has not been already assigned diff --git a/src/hooks/dhcp/flex_option/flex_option.h b/src/hooks/dhcp/flex_option/flex_option.h index 55fc4a71a2..559fcb22c5 100644 --- a/src/hooks/dhcp/flex_option/flex_option.h +++ b/src/hooks/dhcp/flex_option/flex_option.h @@ -375,7 +375,7 @@ public: } } for (auto const& pair : getSubOptionConfigMap()) { - for (const auto& sub_pair : pair.second) { + for (auto const& sub_pair : pair.second) { const SubOptionConfigPtr& sub_cfg = sub_pair.second; uint16_t sub_code = sub_cfg->getCode(); uint16_t opt_code = sub_cfg->getContainerCode(); diff --git a/src/hooks/dhcp/high_availability/ha_config_parser.cc b/src/hooks/dhcp/high_availability/ha_config_parser.cc index 6e4662786a..79f0c305b2 100644 --- a/src/hooks/dhcp/high_availability/ha_config_parser.cc +++ b/src/hooks/dhcp/high_availability/ha_config_parser.cc @@ -100,7 +100,7 @@ HAConfigParser::parseAll(const HAConfigMapperPtr& config_storage, } // Get the HA configuration. - const auto& config_vec = config->listValue(); + auto const& config_vec = config->listValue(); if (config_vec.empty()) { isc_throw(ConfigError, "a list of HA configurations must not be empty"); } @@ -258,7 +258,7 @@ HAConfigParser::parseOne(const HAConfigMapperPtr& config_storage, rel_config->setRestrictCommands(getBoolean(config, "restrict-commands")); // Peers configuration parsing. - const auto& peers_vec = peers->listValue(); + auto const& peers_vec = peers->listValue(); // Go over configuration of each peer. for (auto p = peers_vec.begin(); p != peers_vec.end(); ++p) { @@ -338,7 +338,7 @@ HAConfigParser::parseOne(const HAConfigMapperPtr& config_storage, // Per state configuration is optional. if (states_list) { - const auto& states_vec = states_list->listValue(); + auto const& states_vec = states_list->listValue(); std::set configured_states; diff --git a/src/hooks/dhcp/high_availability/ha_service.cc b/src/hooks/dhcp/high_availability/ha_service.cc index 09f72ca265..1d34b0e889 100644 --- a/src/hooks/dhcp/high_availability/ha_service.cc +++ b/src/hooks/dhcp/high_availability/ha_service.cc @@ -2195,7 +2195,7 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, } // Iterate over the leases and update the database as appropriate. - const auto& leases_element = leases->listValue(); + auto const& leases_element = leases->listValue(); LOG_INFO(ha_logger, HA_LEASES_SYNC_LEASE_PAGE_RECEIVED) .arg(config_->getThisServerName()) diff --git a/src/hooks/dhcp/high_availability/query_filter.cc b/src/hooks/dhcp/high_availability/query_filter.cc index b2538ebdb5..5efda93f96 100644 --- a/src/hooks/dhcp/high_availability/query_filter.cc +++ b/src/hooks/dhcp/high_availability/query_filter.cc @@ -420,7 +420,7 @@ QueryFilter::loadBalance(const dhcp::Pkt4Ptr& query4) const { // identifier has been specified. OptionPtr opt_client_id = query4->getOption(DHO_DHCP_CLIENT_IDENTIFIER); if (opt_client_id && !opt_client_id->getData().empty()) { - const auto& client_id_key = opt_client_id->getData(); + auto const& client_id_key = opt_client_id->getData(); lb_hash = loadBalanceHash(&client_id_key[0], client_id_key.size()); } else { @@ -452,7 +452,7 @@ QueryFilter::loadBalance(const dhcp::Pkt6Ptr& query6) const { // Compute the hash by DUID if the DUID. OptionPtr opt_duid = query6->getOption(D6O_CLIENTID); if (opt_duid && !opt_duid->getData().empty()) { - const auto& duid_key = opt_duid->getData(); + auto const& duid_key = opt_duid->getData(); lb_hash = loadBalanceHash(&duid_key[0], duid_key.size()); } else { diff --git a/src/hooks/dhcp/high_availability/tests/ha_relationship_mapper_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_relationship_mapper_unittest.cc index 648719bf47..34e85eaab2 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_relationship_mapper_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_relationship_mapper_unittest.cc @@ -58,7 +58,7 @@ TEST(HARelationshipMapper, mapGetAll) { EXPECT_NO_THROW(mapper.map("server3", rel2)); EXPECT_NO_THROW(mapper.map("server4", rel2)); - const auto& all = mapper.getAll(); + auto const& all = mapper.getAll(); EXPECT_EQ(2, all.size()); EXPECT_EQ(rel1, all[0]); EXPECT_EQ(rel2, all[1]); diff --git a/src/hooks/dhcp/lease_cmds/lease_cmds.cc b/src/hooks/dhcp/lease_cmds/lease_cmds.cc index 7fc90def1e..243c6382ea 100644 --- a/src/hooks/dhcp/lease_cmds/lease_cmds.cc +++ b/src/hooks/dhcp/lease_cmds/lease_cmds.cc @@ -483,7 +483,7 @@ LeaseCmdsImpl::updateStatsOnAdd(const Lease4Ptr& lease) { static_cast(1)); PoolPtr pool; - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); if (subnet) { pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { @@ -524,7 +524,7 @@ LeaseCmdsImpl::updateStatsOnAdd(const Lease6Ptr& lease) { static_cast(1)); PoolPtr pool; - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { pool = subnet->getPool(lease->type_, lease->addr_, false); if (pool) { @@ -653,7 +653,7 @@ LeaseCmdsImpl::updateStatsOnUpdate(const Lease4Ptr& existing, static_cast(1)); PoolPtr pool; - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); if (subnet) { pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { @@ -789,7 +789,7 @@ LeaseCmdsImpl::updateStatsOnUpdate(const Lease6Ptr& existing, static_cast(1)); PoolPtr pool; - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { pool = subnet->getPool(lease->type_, lease->addr_, false); if (pool) { @@ -833,7 +833,7 @@ LeaseCmdsImpl::updateStatsOnDelete(const Lease4Ptr& lease) { static_cast(-1)); PoolPtr pool; - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); if (subnet) { pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { @@ -874,7 +874,7 @@ LeaseCmdsImpl::updateStatsOnDelete(const Lease6Ptr& lease) { static_cast(-1)); PoolPtr pool; - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { pool = subnet->getPool(lease->type_, lease->addr_, false); if (pool) { @@ -1329,14 +1329,14 @@ LeaseCmdsImpl::leaseGetAllHandler(CalloutHandle& handle) { if (v4) { Lease4Collection leases = LeaseMgrFactory::instance().getLeases4((*subnet_id)->intValue()); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } } else { Lease6Collection leases = LeaseMgrFactory::instance().getLeases6((*subnet_id)->intValue()); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1347,13 +1347,13 @@ LeaseCmdsImpl::leaseGetAllHandler(CalloutHandle& handle) { // There is no 'subnets' argument so let's return all leases. if (v4) { Lease4Collection leases = LeaseMgrFactory::instance().getLeases4(); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } } else { Lease6Collection leases = LeaseMgrFactory::instance().getLeases6(); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1456,7 +1456,7 @@ LeaseCmdsImpl::leaseGetPageHandler(CalloutHandle& handle) { LeasePageSize(page_limit_value)); // Convert leases into JSON list. - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1467,7 +1467,7 @@ LeaseCmdsImpl::leaseGetPageHandler(CalloutHandle& handle) { LeaseMgrFactory::instance().getLeases6(*from_address, LeasePageSize(page_limit_value)); // Convert leases into JSON list. - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1526,7 +1526,7 @@ LeaseCmdsImpl::leaseGetByHwAddressHandler(CalloutHandle& handle) { Lease4Collection leases = LeaseMgrFactory::instance().getLease4(hwaddr); ElementPtr leases_json = Element::createList(); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1576,7 +1576,7 @@ LeaseCmdsImpl::leaseGetByClientIdHandler(CalloutHandle& handle) { Lease4Collection leases = LeaseMgrFactory::instance().getLease4(*clientid); ElementPtr leases_json = Element::createList(); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1626,7 +1626,7 @@ LeaseCmdsImpl::leaseGetByDuidHandler(CalloutHandle& handle) { Lease6Collection leases = LeaseMgrFactory::instance().getLeases6(duid_); ElementPtr leases_json = Element::createList(); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1685,7 +1685,7 @@ LeaseCmdsImpl::leaseGetByHostnameHandler(CalloutHandle& handle) { Lease4Collection leases = LeaseMgrFactory::instance().getLeases4(hostname_); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1693,7 +1693,7 @@ LeaseCmdsImpl::leaseGetByHostnameHandler(CalloutHandle& handle) { Lease6Collection leases = LeaseMgrFactory::instance().getLeases6(hostname_); - for (const auto& lease : leases) { + for (auto const& lease : leases) { ElementPtr lease_json = lease->toElement(); leases_json->add(lease_json); } @@ -1836,7 +1836,7 @@ LeaseCmdsImpl::lease6BulkApplyHandler(CalloutHandle& handle) { auto leases_list = deleted_leases->listValue(); // Iterate over leases to be deleted. - for (const auto& lease_params : leases_list) { + for (auto const& lease_params : leases_list) { // Parsing the lease may throw and it means that the lease // information is malformed. Parameters p = getParameters(true, lease_params); @@ -1853,7 +1853,7 @@ LeaseCmdsImpl::lease6BulkApplyHandler(CalloutHandle& handle) { // Iterate over all leases. auto leases_list = leases->listValue(); - for (const auto& lease_params : leases_list) { + for (auto const& lease_params : leases_list) { Lease6Parser parser; bool force_update; @@ -1872,7 +1872,7 @@ LeaseCmdsImpl::lease6BulkApplyHandler(CalloutHandle& handle) { if (!parsed_deleted_list.empty()) { // Iterate over leases to be deleted. - for (const auto& lease_params_pair : parsed_deleted_list) { + for (auto const& lease_params_pair : parsed_deleted_list) { // This part is outside of the try-catch because an exception // indicates that the command is malformed. @@ -1924,7 +1924,7 @@ LeaseCmdsImpl::lease6BulkApplyHandler(CalloutHandle& handle) { ConstSrvConfigPtr config = CfgMgr::instance().getCurrentCfg(); // Iterate over all leases. - for (const auto& lease : parsed_leases_list) { + for (auto const& lease : parsed_leases_list) { auto result = CONTROL_RESULT_SUCCESS; std::ostringstream text; @@ -2244,7 +2244,7 @@ LeaseCmdsImpl::lease4WipeHandler(CalloutHandle& handle) { auto const& sub = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(id); if (sub) { - for (const auto& pool : sub->getPools(Lease::TYPE_V4)) { + for (auto const& pool : sub->getPools(Lease::TYPE_V4)) { const std::string& name_aa(StatsMgr::generateName("subnet", sub->getID(), StatsMgr::generateName("pool", pool->getID(), "assigned-addresses"))); @@ -2269,7 +2269,7 @@ LeaseCmdsImpl::lease4WipeHandler(CalloutHandle& handle) { const Subnet4Collection* subs = subnets->getAll(); // Go over all subnets and wipe leases in each of them. - for (const auto& sub : *subs) { + for (auto const& sub : *subs) { num += LeaseMgrFactory::instance().wipeLeases4(sub->getID()); ids << " " << sub->getID(); StatsMgr::instance().setValue( @@ -2280,7 +2280,7 @@ LeaseCmdsImpl::lease4WipeHandler(CalloutHandle& handle) { StatsMgr::generateName("subnet", sub->getID(), "declined-addresses"), static_cast(0)); - for (const auto& pool : sub->getPools(Lease::TYPE_V4)) { + for (auto const& pool : sub->getPools(Lease::TYPE_V4)) { const std::string& name_aa(StatsMgr::generateName("subnet", sub->getID(), StatsMgr::generateName("pool", pool->getID(), "assigned-addresses"))); @@ -2367,7 +2367,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) { auto const& sub = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(id); if (sub) { - for (const auto& pool : sub->getPools(Lease::TYPE_NA)) { + for (auto const& pool : sub->getPools(Lease::TYPE_NA)) { const std::string& name_anas(StatsMgr::generateName("subnet", sub->getID(), StatsMgr::generateName("pool", pool->getID(), "assigned-nas"))); @@ -2383,7 +2383,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) { } } - for (const auto& pool : sub->getPools(Lease::TYPE_PD)) { + for (auto const& pool : sub->getPools(Lease::TYPE_PD)) { const std::string& name_apds(StatsMgr::generateName("subnet", sub->getID(), StatsMgr::generateName("pd-pool", pool->getID(), "assigned-pds"))); @@ -2401,7 +2401,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) { const Subnet6Collection* subs = subnets->getAll(); // Go over all subnets and wipe leases in each of them. - for (const auto& sub : *subs) { + for (auto const& sub : *subs) { num += LeaseMgrFactory::instance().wipeLeases6(sub->getID()); ids << " " << sub->getID(); StatsMgr::instance().setValue( @@ -2416,7 +2416,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) { StatsMgr::generateName("subnet", sub->getID(), "declined-addresses"), static_cast(0)); - for (const auto& pool : sub->getPools(Lease::TYPE_NA)) { + for (auto const& pool : sub->getPools(Lease::TYPE_NA)) { const std::string& name_anas(StatsMgr::generateName("subnet", sub->getID(), StatsMgr::generateName("pool", pool->getID(), "assigned-nas"))); @@ -2432,7 +2432,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) { } } - for (const auto& pool : sub->getPools(Lease::TYPE_PD)) { + for (auto const& pool : sub->getPools(Lease::TYPE_PD)) { const std::string& name_apds(StatsMgr::generateName("subnet", sub->getID(), StatsMgr::generateName("pd-pool", pool->getID(), "assigned-pds"))); diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc index 992ee5740f..53b67998a7 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc @@ -1035,7 +1035,7 @@ public: // Create JSON list of required classes. ElementPtr required_classes_element = Element::createList(); - const auto& required_classes = subnet->getRequiredClasses(); + auto const& required_classes = subnet->getRequiredClasses(); for (auto required_class = required_classes.cbegin(); required_class != required_classes.cend(); ++required_class) { @@ -1161,14 +1161,14 @@ public: MySqlBinding::createTimestamp(subnet->getModificationTime())); // (Re)create pools. - for (const auto& pool : subnet->getPools(Lease::TYPE_V4)) { + for (auto const& pool : subnet->getPools(Lease::TYPE_V4)) { createPool4(server_selector, boost::dynamic_pointer_cast(pool), subnet); } // (Re)create options. auto option_spaces = subnet->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = subnet->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1203,7 +1203,7 @@ public: uint64_t pool_id = mysql_insert_id(conn_.mysql_); auto option_spaces = pool->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = pool->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1798,7 +1798,7 @@ public: // (Re)create options. auto option_spaces = shared_network->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = shared_network->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -2721,7 +2721,7 @@ public: MySqlBinding::createTimestamp(client_class->getModificationTime())); // Iterate over the captured dependencies and try to insert them into the database. - for (const auto& dependency : dependencies) { + for (auto const& dependency : dependencies) { try { MySqlBindingCollection in_dependency_bindings = { MySqlBinding::createString(client_class->getName()), @@ -2747,7 +2747,7 @@ public: if (client_class->getCfgOptionDef()) { auto option_defs = client_class->getCfgOptionDef()->getContainer(); auto option_spaces = option_defs.getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionDefContainerPtr defs = option_defs.getItems(option_space); for (auto def = defs->begin(); def != defs->end(); ++def) { createUpdateOptionDef4(server_selector, *def, client_class->getName()); @@ -2757,7 +2757,7 @@ public: // (Re)create options. auto option_spaces = client_class->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = client_class->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -2922,7 +2922,7 @@ public: } // Iterate over the configured DBs and instantiate them. - for (const auto& db : config_ctl->getConfigDatabases()) { + for (auto const& db : config_ctl->getConfigDatabases()) { const std::string& access = db.getAccessString(); auto parameters = db.getParameters(); if (ConfigBackendDHCPv4Mgr::instance().delBackend(parameters["type"], access, true)) { diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc index c32babe9f9..1ab8655f99 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc @@ -1277,7 +1277,7 @@ public: // Create JSON list of required classes. ElementPtr required_classes_element = Element::createList(); - const auto& required_classes = subnet->getRequiredClasses(); + auto const& required_classes = subnet->getRequiredClasses(); for (auto required_class = required_classes.cbegin(); required_class != required_classes.cend(); ++required_class) { @@ -1412,20 +1412,20 @@ public: MySqlBinding::createTimestamp(subnet->getModificationTime())); // (Re)create pools. - for (const auto& pool : subnet->getPools(Lease::TYPE_NA)) { + for (auto const& pool : subnet->getPools(Lease::TYPE_NA)) { createPool6(server_selector, boost::dynamic_pointer_cast(pool), subnet); } // (Re)create pd pools. - for (const auto& pd_pool : subnet->getPools(Lease::TYPE_PD)) { + for (auto const& pd_pool : subnet->getPools(Lease::TYPE_PD)) { createPdPool6(server_selector, boost::dynamic_pointer_cast(pd_pool), subnet); } // (Re)create options. auto option_spaces = subnet->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = subnet->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1461,7 +1461,7 @@ public: uint64_t pool_id = mysql_insert_id(conn_.mysql_); auto option_spaces = pool->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = pool->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1512,7 +1512,7 @@ public: uint64_t pd_pool_id = mysql_insert_id(conn_.mysql_); auto option_spaces = pd_pool->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = pd_pool->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -2137,7 +2137,7 @@ public: // (Re)create options. auto option_spaces = shared_network->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = shared_network->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -3148,7 +3148,7 @@ public: MySqlBinding::createTimestamp(client_class->getModificationTime())); // Iterate over the captured dependencies and try to insert them into the database. - for (const auto& dependency : dependencies) { + for (auto const& dependency : dependencies) { try { MySqlBindingCollection in_dependency_bindings = { MySqlBinding::createString(client_class->getName()), @@ -3174,7 +3174,7 @@ public: if (client_class->getCfgOptionDef()) { auto option_defs = client_class->getCfgOptionDef()->getContainer(); auto option_spaces = option_defs.getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionDefContainerPtr defs = option_defs.getItems(option_space); for (auto def = defs->begin(); def != defs->end(); ++def) { createUpdateOptionDef6(server_selector, *def, client_class->getName()); @@ -3184,7 +3184,7 @@ public: // (Re)create options. auto option_spaces = client_class->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = client_class->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -3349,7 +3349,7 @@ public: } // Iterate over the configured DBs and instantiate them. - for (const auto& db : config_ctl->getConfigDatabases()) { + for (auto const& db : config_ctl->getConfigDatabases()) { const std::string& access = db.getAccessString(); auto parameters = db.getParameters(); if (ConfigBackendDHCPv6Mgr::instance().delBackend(parameters["type"], access, true)) { diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc index 13284b2548..890fc7ff06 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc @@ -974,9 +974,9 @@ MySqlConfigBackendImpl::attachElementToServers(const int index, MySqlBindingPtr MySqlConfigBackendImpl::createInputRelayBinding(const NetworkPtr& network) { ElementPtr relay_element = Element::createList(); - const auto& addresses = network->getRelayAddresses(); + auto const& addresses = network->getRelayAddresses(); if (!addresses.empty()) { - for (const auto& address : addresses) { + for (auto const& address : addresses) { relay_element->add(Element::create(address.toText())); } } diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h index 8592ecf955..c4f84da36c 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h @@ -633,7 +633,7 @@ public: db::MySqlBindingPtr createInputRequiredClassesBinding(const T& object) { // Create JSON list of required classes. data::ElementPtr required_classes_element = data::Element::createList(); - const auto& required_classes = object->getRequiredClasses(); + auto const& required_classes = object->getRequiredClasses(); for (auto required_class = required_classes.cbegin(); required_class != required_classes.cend(); ++required_class) { diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc index 71eb9fa91f..9b99b31a0d 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc @@ -1001,14 +1001,14 @@ public: server_selector, attach_bindings); // (Re)create pools. - for (const auto& pool : subnet->getPools(Lease::TYPE_V4)) { + for (auto const& pool : subnet->getPools(Lease::TYPE_V4)) { createPool4(server_selector, boost::dynamic_pointer_cast(pool), subnet); } // (Re)create options. auto option_spaces = subnet->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = subnet->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1048,7 +1048,7 @@ public: // Add the pool's options. auto option_spaces = pool->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = pool->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1574,7 +1574,7 @@ public: // (Re)create options. auto option_spaces = shared_network->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = shared_network->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -2522,7 +2522,7 @@ public: server_selector, attach_bindings); // Iterate over the captured dependencies and try to insert them into the database. - for (const auto& dependency : dependencies) { + for (auto const& dependency : dependencies) { try { PsqlBindArray in_dependency_bindings; in_dependency_bindings.add(class_name); @@ -2548,7 +2548,7 @@ public: if (client_class->getCfgOptionDef()) { auto option_defs = client_class->getCfgOptionDef()->getContainer(); auto option_spaces = option_defs.getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionDefContainerPtr defs = option_defs.getItems(option_space); for (auto def = defs->begin(); def != defs->end(); ++def) { createUpdateOptionDef4(server_selector, *def, client_class->getName()); @@ -2558,7 +2558,7 @@ public: // (Re)create options. auto option_spaces = client_class->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = client_class->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -2725,7 +2725,7 @@ public: } // Iterate over the configured DBs and instantiate them. - for (const auto& db : config_ctl->getConfigDatabases()) { + for (auto const& db : config_ctl->getConfigDatabases()) { const std::string& access = db.getAccessString(); auto parameters = db.getParameters(); if (ConfigBackendDHCPv4Mgr::instance().delBackend(parameters["type"], access, true)) { diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc index 899f912613..4595a0a5b9 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc @@ -1170,20 +1170,20 @@ public: server_selector, attach_bindings); // (Re)create pools. - for (const auto& pool : subnet->getPools(Lease::TYPE_NA)) { + for (auto const& pool : subnet->getPools(Lease::TYPE_NA)) { createPool6(server_selector, boost::dynamic_pointer_cast(pool), subnet); } // (Re)create pd pools. - for (const auto& pd_pool : subnet->getPools(Lease::TYPE_PD)) { + for (auto const& pd_pool : subnet->getPools(Lease::TYPE_PD)) { createPdPool6(server_selector, boost::dynamic_pointer_cast(pd_pool), subnet); } // (Re)create options. auto option_spaces = subnet->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = subnet->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1223,7 +1223,7 @@ public: // Add the pool's options. auto option_spaces = pool->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = pool->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1277,7 +1277,7 @@ public: // Add the pool's options. auto option_spaces = pd_pool->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = pd_pool->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -1811,7 +1811,7 @@ public: // (Re)create options. auto option_spaces = shared_network->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = shared_network->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -2844,7 +2844,7 @@ public: server_selector, attach_bindings); // Iterate over the captured dependencies and try to insert them into the database. - for (const auto& dependency : dependencies) { + for (auto const& dependency : dependencies) { try { PsqlBindArray in_dependency_bindings; in_dependency_bindings.add(class_name); @@ -2870,7 +2870,7 @@ public: if (client_class->getCfgOptionDef()) { auto option_defs = client_class->getCfgOptionDef()->getContainer(); auto option_spaces = option_defs.getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionDefContainerPtr defs = option_defs.getItems(option_space); for (auto def = defs->begin(); def != defs->end(); ++def) { createUpdateOptionDef6(server_selector, *def, client_class->getName()); @@ -2880,7 +2880,7 @@ public: // (Re)create options. auto option_spaces = client_class->getCfgOption()->getOptionSpaceNames(); - for (const auto& option_space : option_spaces) { + for (auto const& option_space : option_spaces) { OptionContainerPtr options = client_class->getCfgOption()->getAll(option_space); for (auto desc = options->begin(); desc != options->end(); ++desc) { OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc); @@ -3047,7 +3047,7 @@ public: } // Iterate over the configured DBs and instantiate them. - for (const auto& db : config_ctl->getConfigDatabases()) { + for (auto const& db : config_ctl->getConfigDatabases()) { const std::string& access = db.getAccessString(); auto parameters = db.getParameters(); if (ConfigBackendDHCPv6Mgr::instance().delBackend(parameters["type"], access, true)) { diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc b/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc index a3e1534b41..c71918150e 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc @@ -1099,9 +1099,9 @@ void PgSqlConfigBackendImpl::addRelayBinding(PsqlBindArray& bindings, const NetworkPtr& network) { ElementPtr relay_element = Element::createList(); - const auto& addresses = network->getRelayAddresses(); + auto const& addresses = network->getRelayAddresses(); if (!addresses.empty()) { - for (const auto& address : addresses) { + for (auto const& address : addresses) { relay_element->add(Element::create(address.toText())); } } diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h b/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h index e449cb763c..a5cefeea17 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h @@ -600,7 +600,7 @@ public: void addRequiredClassesBinding(db::PsqlBindArray& bindings, const T& object) { // Create JSON list of required classes. data::ElementPtr required_classes_element = data::Element::createList(); - const auto& required_classes = object->getRequiredClasses(); + auto const& required_classes = object->getRequiredClasses(); for (auto required_class = required_classes.cbegin(); required_class != required_classes.cend(); ++required_class) { diff --git a/src/hooks/dhcp/stat_cmds/stat_cmds.cc b/src/hooks/dhcp/stat_cmds/stat_cmds.cc index e09047f470..4e17695d20 100644 --- a/src/hooks/dhcp/stat_cmds/stat_cmds.cc +++ b/src/hooks/dhcp/stat_cmds/stat_cmds.cc @@ -406,7 +406,7 @@ LeaseStatCmdsImpl::makeResultSet4(const ElementPtr& result_wrapper, CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); // Set the bounds on the selected subnet range - const auto& idx = subnets->get(); + auto const& idx = subnets->get(); // Init to ALL so we can use auto auto lower = idx.begin(); @@ -537,7 +537,7 @@ LeaseStatCmdsImpl::makeResultSet6(const ElementPtr& result_wrapper, CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); // Set the bounds on the selected subnet range - const auto& idx = subnets->get(); + auto const& idx = subnets->get(); // Init to ALL so we can use auto auto lower = idx.begin(); diff --git a/src/lib/asiolink/io_service_thread_pool.cc b/src/lib/asiolink/io_service_thread_pool.cc index 8a4488074e..26391478fa 100644 --- a/src/lib/asiolink/io_service_thread_pool.cc +++ b/src/lib/asiolink/io_service_thread_pool.cc @@ -114,7 +114,7 @@ IoServiceThreadPool::checkPermissions(State state) { bool IoServiceThreadPool::checkThreadId(std::thread::id id) { - for (const auto& thread : threads_) { + for (auto const& thread : threads_) { if (id == thread->get_id()) { return (true); } diff --git a/src/lib/asiolink/tests/addr_utilities_unittest.cc b/src/lib/asiolink/tests/addr_utilities_unittest.cc index 4db67cd5c5..f9f05fa8cd 100644 --- a/src/lib/asiolink/tests/addr_utilities_unittest.cc +++ b/src/lib/asiolink/tests/addr_utilities_unittest.cc @@ -248,7 +248,7 @@ TEST(AddrUtilitiesTest, addrsInRange6) { // Checks if IPv4 address ranges can be converted to prefix / prefix_len TEST(AddrUtilitiesTest, prefixLengthFromRange4) { // Use a shorter name - const auto& plfr = prefixLengthFromRange; + auto const& plfr = prefixLengthFromRange; // Let's start with something simple EXPECT_EQ(32, plfr(IOAddress("192.0.2.0"), IOAddress("192.0.2.0"))); @@ -279,7 +279,7 @@ TEST(AddrUtilitiesTest, prefixLengthFromRange4) { // Checks if IPv6 address ranges can be converted to prefix / prefix_len TEST(AddrUtilitiesTest, prefixLengthFromRange6) { // Use a shorter name - const auto& plfr = prefixLengthFromRange; + auto const& plfr = prefixLengthFromRange; // Let's start with something simple EXPECT_EQ(128, plfr(IOAddress("::"), IOAddress("::"))); diff --git a/src/lib/cc/command_interpreter.cc b/src/lib/cc/command_interpreter.cc index 50b390621d..ebef7d7d54 100644 --- a/src/lib/cc/command_interpreter.cc +++ b/src/lib/cc/command_interpreter.cc @@ -213,7 +213,7 @@ parseCommand(ConstElementPtr& arg, ConstElementPtr command) { // Make sure that all specified parameters are supported. auto const& command_params = command->mapValue(); - for (const auto& param : command_params) { + for (auto const& param : command_params) { if ((param.first != CONTROL_COMMAND) && (param.first != CONTROL_ARGUMENTS) && (param.first != CONTROL_SERVICE) && diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index 8350462844..abcb0fbc4f 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -1122,7 +1122,7 @@ MapElement::equals(const Element& other) const { if (size() != other.size()) { return (false); } - for (const auto& kv : mapValue()) { + for (auto const& kv : mapValue()) { auto key = kv.first; if (other.contains(key)) { if (!get(key)->equals(*other.get(key))) { @@ -1156,7 +1156,7 @@ removeIdentical(ElementPtr a, ConstElementPtr b) { // over a checking for identical entries in b or vice-versa. As elements // are removed from a if a match is found, we choose to iterate over b to // avoid problems with element removal affecting the iterator. - for (const auto& kv : b->mapValue()) { + for (auto const& kv : b->mapValue()) { auto key = kv.first; if (a->contains(key)) { if (a->get(key)->equals(*b->get(key))) { @@ -1178,7 +1178,7 @@ removeIdentical(ConstElementPtr a, ConstElementPtr b) { isc_throw(TypeError, "Non-map Elements passed to removeIdentical"); } - for (const auto& kv : a->mapValue()) { + for (auto const& kv : a->mapValue()) { auto key = kv.first; if (!b->contains(key) || !a->get(key)->equals(*b->get(key))) { @@ -1196,7 +1196,7 @@ merge(ElementPtr element, ConstElementPtr other) { isc_throw(TypeError, "merge arguments not MapElements"); } - for (const auto& kv : other->mapValue()) { + for (auto const& kv : other->mapValue()) { auto key = kv.first; auto value = kv.second; if (value && value->getType() != Element::null) { @@ -1249,7 +1249,7 @@ mergeDiffAdd(ElementPtr& element, ElementPtr& other, } if (element->getType() == Element::map) { - for (const auto& kv : other->mapValue()) { + for (auto const& kv : other->mapValue()) { auto current_key = kv.first; auto value = boost::const_pointer_cast(kv.second); if (value && value->getType() != Element::null) { @@ -1318,7 +1318,7 @@ mergeDiffDel(ElementPtr& element, ElementPtr& other, // If the resulting element still contains data, we need to restore the // key parameters, so we store them here. ElementPtr new_elements = Element::createMap(); - for (const auto& kv : other->mapValue()) { + for (auto const& kv : other->mapValue()) { auto current_key = kv.first; auto value = boost::const_pointer_cast(kv.second); if (value && value->getType() != Element::null) { @@ -1349,7 +1349,7 @@ mergeDiffDel(ElementPtr& element, ElementPtr& other, } // If the element still contains data, restore the key elements. if (element->size()) { - for (const auto& kv : new_elements->mapValue()) { + for (auto const& kv : new_elements->mapValue()) { element->set(kv.first, kv.second); } } @@ -1389,7 +1389,7 @@ extend(const std::string& container, const std::string& extension, } if (element->getType() == Element::map) { - for (const auto& kv : other->mapValue()) { + for (auto const& kv : other->mapValue()) { auto current_key = kv.first; auto value = boost::const_pointer_cast(kv.second); if (value && value->getType() != Element::null) { @@ -1428,7 +1428,7 @@ copy(ConstElementPtr from, int level) { return (ElementPtr(new StringElement(from->stringValue()))); } else if (from_type == Element::list) { ElementPtr result = ElementPtr(new ListElement()); - for (const auto& elem : from->listValue()) { + for (auto const& elem : from->listValue()) { if (level == 0) { result->add(elem); } else { @@ -1438,7 +1438,7 @@ copy(ConstElementPtr from, int level) { return (result); } else if (from_type == Element::map) { ElementPtr result = ElementPtr(new MapElement()); - for (const auto& kv : from->mapValue()) { + for (auto const& kv : from->mapValue()) { auto key = kv.first; auto value = kv.second; if (level == 0) { @@ -1517,7 +1517,7 @@ isEquivalent0(ConstElementPtr a, ConstElementPtr b, unsigned level) { return (false); } // iterate on the first map - for (const auto& kv : a->mapValue()) { + for (auto const& kv : a->mapValue()) { // get the b value for the given keyword and recurse ConstElementPtr item = b->get(kv.first); if (!item || !isEquivalent0(kv.second, item, level - 1)) { @@ -1565,7 +1565,7 @@ prettyPrint(ConstElementPtr element, std::ostream& out, out << "[" << (complex ? "\n" : " "); // iterate on items - const auto& l = element->listValue(); + auto const& l = element->listValue(); for (auto it = l.begin(); it != l.end(); ++it) { // add the separator if not the first item if (it != l.begin()) { @@ -1597,7 +1597,7 @@ prettyPrint(ConstElementPtr element, std::ostream& out, out << "{\n"; // iterate on keyword: value - const auto& m = element->mapValue(); + auto const& m = element->mapValue(); bool first = true; for (auto it = m.begin(); it != m.end(); ++it) { // add the separator if not the first item diff --git a/src/lib/cc/simple_parser.cc b/src/lib/cc/simple_parser.cc index e0baa31fd1..314d2888c3 100644 --- a/src/lib/cc/simple_parser.cc +++ b/src/lib/cc/simple_parser.cc @@ -24,7 +24,7 @@ namespace data { void SimpleParser::checkRequired(const SimpleRequiredKeywords& required, ConstElementPtr scope) { - for (const auto& name : required) { + for (auto const& name : required) { if (scope->contains(name)) { continue; } @@ -36,7 +36,7 @@ void SimpleParser::checkKeywords(const SimpleKeywords& keywords, ConstElementPtr scope) { string spurious; - for (const auto& entry : scope->mapValue()) { + for (auto const& entry : scope->mapValue()) { if (keywords.count(entry.first) == 0) { if (spurious.empty()) { spurious = entry.first; diff --git a/src/lib/cc/stamped_element.cc b/src/lib/cc/stamped_element.cc index 93915d63ca..0314273297 100644 --- a/src/lib/cc/stamped_element.cc +++ b/src/lib/cc/stamped_element.cc @@ -38,7 +38,7 @@ StampedElement::getMetadata() const { ElementPtr metadata = Element::createMap(); ElementPtr tags = Element::createList(); - for (const auto& server_tag : server_tags_) { + for (auto const& server_tag : server_tags_) { tags->add(Element::create(server_tag.get())); } diff --git a/src/lib/config_backend/base_config_backend_pool.h b/src/lib/config_backend/base_config_backend_pool.h index 55ed91d01e..64d754063c 100644 --- a/src/lib/config_backend/base_config_backend_pool.h +++ b/src/lib/config_backend/base_config_backend_pool.h @@ -171,7 +171,7 @@ protected: // If no particular backend is selected, call each backend and return // the first non-null (non zero) value. if (backend_selector.amUnspecified()) { - for (const auto& backend : backends_) { + for (auto const& backend : backends_) { property = ((*backend).*MethodPointer)(server_selector, input...); if (property) { break; @@ -182,7 +182,7 @@ protected: // Backend selected, find the one that matches selection. auto backends = selectBackends(backend_selector); if (!backends.empty()) { - for (const auto& backend : backends) { + for (auto const& backend : backends) { property = ((*backend).*MethodPointer)(server_selector, input...); if (property) { break; @@ -312,7 +312,7 @@ protected: PropertyCollectionType& properties, Args... input) const { if (backend_selector.amUnspecified()) { - for (const auto& backend : backends_) { + for (auto const& backend : backends_) { properties = ((*backend).*MethodPointer)(server_selector, input...); if (!properties.empty()) { break; @@ -322,7 +322,7 @@ protected: } else { auto backends = selectBackends(backend_selector); if (!backends.empty()) { - for (const auto& backend : backends) { + for (auto const& backend : backends) { properties = ((*backend).*MethodPointer)(server_selector, input...); if (!properties.empty()) { break; @@ -382,7 +382,7 @@ protected: const db::ServerSelector& server_selector, PropertyCollectionType& properties) const { if (backend_selector.amUnspecified()) { - for (const auto& backend : backends_) { + for (auto const& backend : backends_) { properties = ((*backend).*MethodPointer)(server_selector); if (!properties.empty()) { break; @@ -392,7 +392,7 @@ protected: } else { auto backends = selectBackends(backend_selector); if (!backends.empty()) { - for (const auto& backend : backends) { + for (auto const& backend : backends) { properties = ((*backend).*MethodPointer)(server_selector); if (!properties.empty()) { break; @@ -609,7 +609,7 @@ protected: } // Go over all backends. - for (const auto& backend : backends_) { + for (auto const& backend : backends_) { // If backend type is specified and it is not matching, // do not select this backend. if ((backend_selector.getBackendType() != db::BackendSelector::Type::UNSPEC) && diff --git a/src/lib/config_backend/tests/config_backend_mgr_unittest.cc b/src/lib/config_backend/tests/config_backend_mgr_unittest.cc index 7a4fad632c..99866e292f 100644 --- a/src/lib/config_backend/tests/config_backend_mgr_unittest.cc +++ b/src/lib/config_backend/tests/config_backend_mgr_unittest.cc @@ -56,7 +56,7 @@ public: /// @return Value of the property or 0 if property doesn't exist. virtual int getProperty(const ServerSelector&, const std::string& property_name) const { - for (const auto& property : properties_) { + for (auto const& property : properties_) { if (property.first == property_name) { return (property.second); } @@ -72,7 +72,7 @@ public: virtual int getProperty(const ServerSelector&, const std::string& property_name, const int property_value) const { - for (const auto& property : properties_) { + for (auto const& property : properties_) { if ((property.first == property_name) && (property.second == property_value)) { return (property.second); @@ -89,7 +89,7 @@ public: virtual PropertiesList getProperties(const ServerSelector&, const std::string& property_name) const { PropertiesList properties; - for (const auto& property : properties_) { + for (auto const& property : properties_) { if (property.first == property_name) { properties.push_back(property); } diff --git a/src/lib/d2srv/d2_stats.cc b/src/lib/d2srv/d2_stats.cc index 8534f13924..e334b7011d 100644 --- a/src/lib/d2srv/d2_stats.cc +++ b/src/lib/d2srv/d2_stats.cc @@ -46,10 +46,10 @@ void D2Stats::init() { StatsMgr& stats_mgr = isc::stats::StatsMgr::instance(); stats_mgr.setMaxSampleCountDefault(0); - for (const auto& name : D2Stats::ncr) { + for (auto const& name : D2Stats::ncr) { stats_mgr.setValue(name, static_cast(0)); } - for (const auto& name : D2Stats::update) { + for (auto const& name : D2Stats::update) { stats_mgr.setValue(name, static_cast(0)); } }; diff --git a/src/lib/d2srv/d2_tsig_key.cc b/src/lib/d2srv/d2_tsig_key.cc index 75dc5277a4..3835403ad3 100644 --- a/src/lib/d2srv/d2_tsig_key.cc +++ b/src/lib/d2srv/d2_tsig_key.cc @@ -37,7 +37,7 @@ void D2TsigKey::initStats() { StatsMgr& stats_mgr = StatsMgr::instance(); const string& kname = getKeyName().toText(); - for (const auto& name : D2Stats::key) { + for (auto const& name : D2Stats::key) { const string& sname = StatsMgr::generateName("key", kname, name); stats_mgr.setValue(sname, static_cast(0)); } @@ -47,7 +47,7 @@ void D2TsigKey::removeStats() { StatsMgr& stats_mgr = StatsMgr::instance(); const string& kname = getKeyName().toText(); - for (const auto& name : D2Stats::key) { + for (auto const& name : D2Stats::key) { string sname = StatsMgr::generateName("key", kname, name); stats_mgr.del(sname); } @@ -57,7 +57,7 @@ void D2TsigKey::resetStats() { StatsMgr& stats_mgr = StatsMgr::instance(); const string& kname = getKeyName().toText(); - for (const auto& name : D2Stats::key) { + for (auto const& name : D2Stats::key) { string sname = StatsMgr::generateName("key", kname, name); stats_mgr.reset(sname); } diff --git a/src/lib/d2srv/testutils/stats_test_utils.cc b/src/lib/d2srv/testutils/stats_test_utils.cc index 262879b421..e145f56db7 100644 --- a/src/lib/d2srv/testutils/stats_test_utils.cc +++ b/src/lib/d2srv/testutils/stats_test_utils.cc @@ -28,7 +28,7 @@ D2StatTest::~D2StatTest() { void checkStats(const string& key_name, const StatMap& expected_stats) { StatMap key_stats; - for (const auto& it : expected_stats) { + for (auto const& it : expected_stats) { const string& stat_name = StatsMgr::generateName("key", key_name, it.first); key_stats[stat_name] = it.second; diff --git a/src/lib/database/database_connection.cc b/src/lib/database/database_connection.cc index 43bdfaaae6..8da9bca1bc 100644 --- a/src/lib/database/database_connection.cc +++ b/src/lib/database/database_connection.cc @@ -220,7 +220,7 @@ isc::data::ElementPtr DatabaseConnection::toElement(const ParameterMap& params) { isc::data::ElementPtr result = isc::data::Element::createMap(); - for (const auto& param : params) { + for (auto const& param : params) { std::string keyword = param.first; std::string value = param.second; diff --git a/src/lib/database/dbaccess_parser.cc b/src/lib/database/dbaccess_parser.cc index f6e70eacaf..05fe96eeed 100644 --- a/src/lib/database/dbaccess_parser.cc +++ b/src/lib/database/dbaccess_parser.cc @@ -270,7 +270,7 @@ DbAccessParser::getDbAccessString() const { // Construct the database access string from all keywords and values in the // parameter map where the value is not null. string dbaccess; - for (const auto& keyval : values_) { + for (auto const& keyval : values_) { if (!keyval.second.empty()) { // Separate keyword/value pair from predecessor (if there is one). diff --git a/src/lib/database/server_selector.cc b/src/lib/database/server_selector.cc index 09e39a6e85..1d8031327d 100644 --- a/src/lib/database/server_selector.cc +++ b/src/lib/database/server_selector.cc @@ -24,7 +24,7 @@ ServerSelector::MULTIPLE(const std::set& server_tags) { std::set tags; // Create a set of tags from strings. - for (const auto& tag : server_tags) { + for (auto const& tag : server_tags) { tags.insert(ServerTag(tag)); } diff --git a/src/lib/database/tests/audit_entry_unittest.cc b/src/lib/database/tests/audit_entry_unittest.cc index 1d41872265..e84a7877ec 100644 --- a/src/lib/database/tests/audit_entry_unittest.cc +++ b/src/lib/database/tests/audit_entry_unittest.cc @@ -243,7 +243,7 @@ public: // Checks that entries can be found by object type. TEST_F(AuditEntryCollectionTest, getByObjectType) { - const auto& object_type_idx = audit_entries_.get(); + auto const& object_type_idx = audit_entries_.get(); // Search for "dhcp4_subnet" objects. auto range = object_type_idx.equal_range("dhcp4_subnet"); @@ -266,7 +266,7 @@ TEST_F(AuditEntryCollectionTest, getByObjectType) { // Checks that entries can be found by modification time. TEST_F(AuditEntryCollectionTest, getByModificationTime) { - const auto& mod_time_idx = audit_entries_.get(); + auto const& mod_time_idx = audit_entries_.get(); // Search for objects later than fixed time - 10s. auto lb = mod_time_idx.lower_bound(diffTime(-10)); @@ -313,7 +313,7 @@ TEST_F(AuditEntryCollectionTest, getByModificationTime) { // Checks that entries can be found by modification time and id. TEST_F(AuditEntryCollectionTest, getByModificationTimeAndId) { - const auto& mod_time_idx = audit_entries_.get(); + auto const& mod_time_idx = audit_entries_.get(); // Search for objects later than added added subnet 10. auto mod = boost::make_tuple(diffTime(-5), 100 + 1); @@ -337,7 +337,7 @@ TEST_F(AuditEntryCollectionTest, getByModificationTimeAndId) { // Checks that entries can be found by object id. TEST_F(AuditEntryCollectionTest, getByObjectId) { - const auto& object_id_idx = audit_entries_.get(); + auto const& object_id_idx = audit_entries_.get(); // Search for object id 10. auto range = object_id_idx.equal_range(10); diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc index 8dbf4d587d..861767920c 100644 --- a/src/lib/dhcp/iface_mgr.cc +++ b/src/lib/dhcp/iface_mgr.cc @@ -828,7 +828,7 @@ IfaceCollection::getIfaceInternal(const unsigned int ifindex, const bool need_lo return (cache_); } } - const auto& idx = ifaces_container_.get<1>(); + auto const& idx = ifaces_container_.get<1>(); auto it = idx.find(ifindex); if (it == idx.end()) { return (IfacePtr()); // not found @@ -855,7 +855,7 @@ IfaceCollection::getIfaceInternal(const std::string& ifname, const bool need_loc return (cache_); } } - const auto& idx = ifaces_container_.get<2>(); + auto const& idx = ifaces_container_.get<2>(); auto it = idx.find(ifname); if (it == idx.end()) { return (IfacePtr()); // not found diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc index a9bdb69d7a..760765bc45 100644 --- a/src/lib/dhcp/libdhcp++.cc +++ b/src/lib/dhcp/libdhcp++.cc @@ -693,7 +693,7 @@ void extendVivco(OptionCollection& options) { typedef vector TuplesCollection; map vendors_tuples; - const auto& range = options.equal_range(DHO_VIVCO_SUBOPTIONS); + auto const& range = options.equal_range(DHO_VIVCO_SUBOPTIONS); for (auto it = range.first; it != range.second; ++it) { uint32_t offset = 0; auto const& data = it->second->getData(); @@ -752,7 +752,7 @@ extendVivco(OptionCollection& options) { void extendVivso(OptionCollection& options) { map vendors_data; - const auto& range = options.equal_range(DHO_VIVSO_SUBOPTIONS); + auto const& range = options.equal_range(DHO_VIVSO_SUBOPTIONS); for (auto it = range.first; it != range.second; ++it) { uint32_t offset = 0; auto const& data = it->second->getData(); diff --git a/src/lib/dhcp/option4_dnr.cc b/src/lib/dhcp/option4_dnr.cc index f1b50cb6da..c6e7c035d5 100644 --- a/src/lib/dhcp/option4_dnr.cc +++ b/src/lib/dhcp/option4_dnr.cc @@ -380,7 +380,7 @@ DnrInstance::getDnrInstanceAsText() const { << "adn='" << getAdnAsText() << "'"; if (!adn_only_mode_) { stream << ", addr_length=" << addr_length_ << ", address(es):"; - for (const auto& address : ip_addresses_) { + for (auto const& address : ip_addresses_) { stream << " " << address.toText(); } diff --git a/src/lib/dhcp/option6_dnr.cc b/src/lib/dhcp/option6_dnr.cc index 3d7bb0fcd8..d527bbc534 100644 --- a/src/lib/dhcp/option6_dnr.cc +++ b/src/lib/dhcp/option6_dnr.cc @@ -41,7 +41,7 @@ Option6Dnr::pack(util::OutputBuffer& buf, bool check) const { void Option6Dnr::packAddresses(util::OutputBuffer& buf) const { - for (const auto& address : ip_addresses_) { + for (auto const& address : ip_addresses_) { if (!address.isV6()) { isc_throw(isc::BadValue, getLogPrefix() << address.toText() << " is not an IPv6 address"); diff --git a/src/lib/dhcp/pkt.cc b/src/lib/dhcp/pkt.cc index 26224602ff..2484d974ff 100644 --- a/src/lib/dhcp/pkt.cc +++ b/src/lib/dhcp/pkt.cc @@ -53,7 +53,7 @@ Pkt::addOption(const OptionPtr& opt) { OptionPtr Pkt::getNonCopiedOption(const uint16_t type) const { - const auto& x = options_.find(type); + auto const& x = options_.find(type); if (x != options_.end()) { return (x->second); } @@ -62,7 +62,7 @@ Pkt::getNonCopiedOption(const uint16_t type) const { OptionPtr Pkt::getOption(const uint16_t type) { - const auto& x = options_.find(type); + auto const& x = options_.find(type); if (x != options_.end()) { if (copy_retrieved_options_) { OptionPtr option_copy = x->second->clone(); @@ -102,7 +102,7 @@ Pkt::getOptions(const uint16_t opt_type) { bool Pkt::delOption(uint16_t type) { - const auto& x = options_.find(type); + auto const& x = options_.find(type); if (x != options_.end()) { options_.erase(x); return (true); // delete successful diff --git a/src/lib/dhcp/pkt4.cc b/src/lib/dhcp/pkt4.cc index bb5276639c..e9a62f6be8 100644 --- a/src/lib/dhcp/pkt4.cc +++ b/src/lib/dhcp/pkt4.cc @@ -60,7 +60,7 @@ Pkt4::len() { size_t length = DHCPV4_PKT_HDR_LEN; // DHCPv4 header // ... and sum of lengths of all options - for (const auto& it : options_) { + for (auto const& it : options_) { length += it.second->len(); } @@ -447,7 +447,7 @@ Pkt4::toText() const { if (!options_.empty()) { tmp << "," << endl << "options:"; - for (const auto& opt : options_) { + for (auto const& opt : options_) { try { tmp << endl << opt.second->toText(2); } catch (...) { diff --git a/src/lib/dhcp/pkt6.cc b/src/lib/dhcp/pkt6.cc index eb800f90ae..aba14c691e 100644 --- a/src/lib/dhcp/pkt6.cc +++ b/src/lib/dhcp/pkt6.cc @@ -44,7 +44,7 @@ std::string Pkt6::RelayInfo::toText() const { << "link-address=" << linkaddr_.toText() << ", peer-address=" << peeraddr_.toText() << ", " << options_.size() << " option(s)" << endl; - for (const auto& option : options_) { + for (auto const& option : options_) { tmp << option.second->toText() << endl; } return (tmp.str()); @@ -346,7 +346,7 @@ uint16_t Pkt6::getRelayOverhead(const RelayInfo& relay) const { uint16_t len = DHCPV6_RELAY_HDR_LEN // fixed header + Option::OPTION6_HDR_LEN; // header of the relay-msg option - for (const auto& opt : relay.options_) { + for (auto const& opt : relay.options_) { len += (opt.second)->len(); } @@ -368,7 +368,7 @@ uint16_t Pkt6::calculateRelaySizes() { uint16_t Pkt6::directLen() const { uint16_t length = DHCPV6_PKT_HDR_LEN; // DHCPv6 header - for (const auto& it : options_) { + for (auto const& it : options_) { length += it.second->len(); } @@ -422,7 +422,7 @@ Pkt6::packUDP() { // present here as well (vendor-opts for Cable modems, // subscriber-id, remote-id, options echoed back from Echo // Request Option, etc.) - for (const auto& opt : relay->options_) { + for (auto const& opt : relay->options_) { (opt.second)->pack(buffer_out_); } @@ -738,7 +738,7 @@ Pkt6::toText() const { if (!options_.empty()) { tmp << "," << endl << "options:"; - for (const auto& opt : options_) { + for (auto const& opt : options_) { try { tmp << endl << opt.second->toText(2); } catch (...) { @@ -754,7 +754,7 @@ Pkt6::toText() const { if (!relay_info_.empty()) { tmp << endl << relay_info_.size() << " relay(s):" << endl; int cnt = 0; - for (const auto& relay : relay_info_) { + for (auto const& relay : relay_info_) { tmp << "relay[" << cnt++ << "]: " << relay.toText(); } } else { diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 4819e3be6a..111a3a9347 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -1543,9 +1543,9 @@ AllocEngine::removeNonmatchingReservedLeases6(ClientContext6& ctx, "assigned-nas" : "assigned-pds"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(candidate->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(candidate->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(ctx.currentIA().type_, candidate->addr_, false); + auto const& pool = subnet->getPool(ctx.currentIA().type_, candidate->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -1602,9 +1602,9 @@ AllocEngine::removeNonmatchingReservedNoHostLeases6(ClientContext6& ctx, "assigned-nas" : "assigned-pds"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(candidate->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(candidate->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(candidate->type_, candidate->addr_, false); + auto const& pool = subnet->getPool(candidate->type_, candidate->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -1685,9 +1685,9 @@ AllocEngine::removeNonreservedLeases6(ClientContext6& ctx, "assigned-nas" : "assigned-pds"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId((*lease)->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId((*lease)->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(ctx.currentIA().type_, (*lease)->addr_, false); + auto const& pool = subnet->getPool(ctx.currentIA().type_, (*lease)->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -1814,7 +1814,7 @@ AllocEngine::reuseExpiredLease(Lease6Ptr& expired, ClientContext6& ctx, // Add (update) the extended information on the lease. updateLease6ExtendedInfo(expired, ctx); - const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, expired->addr_, false); + auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, expired->addr_, false); if (pool) { expired->pool_id_ = pool->getID(); } @@ -2007,7 +2007,7 @@ Lease6Ptr AllocEngine::createLease6(ClientContext6& ctx, // Add (update) the extended information on the lease. updateLease6ExtendedInfo(lease, ctx); - const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); + auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); if (pool) { lease->pool_id_ = pool->getID(); } @@ -2222,7 +2222,7 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) { "assigned-nas" : "assigned-pds"), static_cast(-1)); - const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); + auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", ctx.subnet_->getID(), @@ -2358,7 +2358,7 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) { // Now that the lease has been reclaimed, we can go ahead and update it // in the lease database. if (lease->reuseable_valid_lft_ == 0) { - const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); + auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); if (pool) { lease->pool_id_ = pool->getID(); } @@ -2378,7 +2378,7 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) { "cumulative-assigned-nas" : "cumulative-assigned-pds"), static_cast(1)); - const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); + auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", ctx.subnet_->getID(), @@ -2476,7 +2476,7 @@ AllocEngine::updateLeaseData(ClientContext6& ctx, const Lease6Collection& leases "cumulative-assigned-nas" : "cumulative-assigned-pds"), static_cast(1)); - const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); + auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", ctx.subnet_->getID(), @@ -2910,9 +2910,9 @@ AllocEngine::reclaimExpiredLease(const Lease6Ptr& lease, "assigned-nas"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(lease->type_, lease->addr_, false); + auto const& pool = subnet->getPool(lease->type_, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -2935,9 +2935,9 @@ AllocEngine::reclaimExpiredLease(const Lease6Ptr& lease, "assigned-pds"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(lease->type_, lease->addr_, false); + auto const& pool = subnet->getPool(lease->type_, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -3049,9 +3049,9 @@ AllocEngine::reclaimExpiredLease(const Lease4Ptr& lease, "reclaimed-leases"), static_cast(1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -3139,9 +3139,9 @@ AllocEngine::reclaimDeclined(const Lease4Ptr& lease) { "reclaimed-declined-addresses"), static_cast(1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { stats_mgr.addValue(StatsMgr::generateName("subnet", subnet->getID(), StatsMgr::generateName("pool" , pool->getID(), @@ -3211,9 +3211,9 @@ AllocEngine::reclaimDeclined(const Lease6Ptr& lease) { "reclaimed-declined-addresses"), static_cast(1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(lease->type_, lease->addr_, false); + auto const& pool = subnet->getPool(lease->type_, lease->addr_, false); if (pool) { stats_mgr.addValue(StatsMgr::generateName("subnet", subnet->getID(), StatsMgr::generateName("pool" , pool->getID(), @@ -4135,9 +4135,9 @@ AllocEngine::requestLease4(AllocEngine::ClientContext4& ctx) { "assigned-addresses"), static_cast(-1)); - const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(client_lease->subnet_id_); + auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(client_lease->subnet_id_); if (subnet) { - const auto& pool = subnet->getPool(Lease::TYPE_V4, client_lease->addr_, false); + auto const& pool = subnet->getPool(Lease::TYPE_V4, client_lease->addr_, false); if (pool) { StatsMgr::instance().addValue( StatsMgr::generateName("subnet", subnet->getID(), @@ -4333,7 +4333,7 @@ AllocEngine::createLease4(const ClientContext4& ctx, const IOAddress& addr, } if (!ctx.fake_allocation_ || ctx.offer_lft_) { - const auto& pool = ctx.subnet_->getPool(Lease::TYPE_V4, lease->addr_, false); + auto const& pool = ctx.subnet_->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { lease->pool_id_ = pool->getID(); } @@ -4467,7 +4467,7 @@ AllocEngine::renewLease4(const Lease4Ptr& lease, } if ((!ctx.fake_allocation_ || ctx.offer_lft_) && !skip && (lease->reuseable_valid_lft_ == 0)) { - const auto& pool = ctx.subnet_->getPool(Lease::TYPE_V4, lease->addr_, false); + auto const& pool = ctx.subnet_->getPool(Lease::TYPE_V4, lease->addr_, false); if (pool) { lease->pool_id_ = pool->getID(); } @@ -4595,7 +4595,7 @@ AllocEngine::reuseExpiredLease4(Lease4Ptr& expired, } if (!ctx.fake_allocation_ || ctx.offer_lft_) { - const auto& pool = ctx.subnet_->getPool(Lease::TYPE_V4, expired->addr_, false); + auto const& pool = ctx.subnet_->getPool(Lease::TYPE_V4, expired->addr_, false); if (pool) { expired->pool_id_ = pool->getID(); } diff --git a/src/lib/dhcpsrv/cb_ctl_dhcp.h b/src/lib/dhcpsrv/cb_ctl_dhcp.h index c34f6f6117..926946de89 100644 --- a/src/lib/dhcpsrv/cb_ctl_dhcp.h +++ b/src/lib/dhcpsrv/cb_ctl_dhcp.h @@ -44,14 +44,14 @@ protected: /// backend void addGlobalsToConfig(SrvConfigPtr external_cfg, data::StampedValueCollection& cb_globals) const { - const auto& index = cb_globals.get(); + auto const& index = cb_globals.get(); for (auto cb_global = index.begin(); cb_global != index.end(); ++cb_global) { if ((*cb_global)->amNull()) { continue; } - external_cfg->addConfiguredGlobal((*cb_global)->getName(), + external_cfg->addConfiguredGlobal((*cb_global)->getName(), (*cb_global)->getElementValue()); } } diff --git a/src/lib/dhcpsrv/cb_ctl_dhcp4.cc b/src/lib/dhcpsrv/cb_ctl_dhcp4.cc index 5ba211f519..37efb8a4bc 100644 --- a/src/lib/dhcpsrv/cb_ctl_dhcp4.cc +++ b/src/lib/dhcpsrv/cb_ctl_dhcp4.cc @@ -66,7 +66,7 @@ CBControlDHCPv4::databaseConfigApply(const BackendSelector& backend_selector, auto external_cfg = CfgMgr::instance().createExternalCfg(); // Get audit entries for deleted global parameters. - const auto& index = audit_entries.get(); + auto const& index = audit_entries.get(); auto range = index.equal_range(boost::make_tuple("dhcp4_global_parameter", AuditEntry::ModificationType::DELETE)); if (range.first != range.second) { diff --git a/src/lib/dhcpsrv/cb_ctl_dhcp6.cc b/src/lib/dhcpsrv/cb_ctl_dhcp6.cc index 91b482ebad..ca74a5e531 100644 --- a/src/lib/dhcpsrv/cb_ctl_dhcp6.cc +++ b/src/lib/dhcpsrv/cb_ctl_dhcp6.cc @@ -64,7 +64,7 @@ CBControlDHCPv6::databaseConfigApply(const db::BackendSelector& backend_selector auto external_cfg = CfgMgr::instance().createExternalCfg(); // Get audit entries for deleted global parameters. - const auto& index = audit_entries.get(); + auto const& index = audit_entries.get(); auto range = index.equal_range(boost::make_tuple("dhcp6_global_parameter", AuditEntry::ModificationType::DELETE)); if (range.first != range.second) { diff --git a/src/lib/dhcpsrv/cfg_hosts.cc b/src/lib/dhcpsrv/cfg_hosts.cc index febf988285..bee54332bc 100644 --- a/src/lib/dhcpsrv/cfg_hosts.cc +++ b/src/lib/dhcpsrv/cfg_hosts.cc @@ -1100,7 +1100,7 @@ CfgHosts::del(const SubnetID& subnet_id, const asiolink::IOAddress& addr) { HostContainer6Index1& idx6 = hosts6_.get<1>(); HostContainerIndex4& idx = hosts_.get<4>(); // Delete IPv6 reservations. - const auto& range = idx6.equal_range(boost::make_tuple(subnet_id, addr)); + auto const& range = idx6.equal_range(boost::make_tuple(subnet_id, addr)); erased_addresses = boost::distance(range); // Delete hosts. for (auto key = range.first; key != range.second; ++key) { @@ -1136,10 +1136,10 @@ CfgHosts::del4(const SubnetID& subnet_id, const uint8_t* identifier_begin, const size_t identifier_len) { HostContainerIndex0& idx = hosts_.get<0>(); - const auto t = boost::make_tuple(std::vector(identifier_begin, + auto const t = boost::make_tuple(std::vector(identifier_begin, identifier_begin + identifier_len), identifier_type); - const auto& range = idx.equal_range(t); + auto const& range = idx.equal_range(t); size_t erased = 0; for (auto key = range.first; key != range.second;) { if ((*key)->getIPv4SubnetID() != subnet_id) { @@ -1186,10 +1186,10 @@ CfgHosts::del6(const SubnetID& subnet_id, HostContainerIndex0& idx = hosts_.get<0>(); HostContainer6Index3& idx6 = hosts6_.get<3>(); - const auto t = boost::make_tuple(std::vector(identifier_begin, + auto const t = boost::make_tuple(std::vector(identifier_begin, identifier_begin + identifier_len), identifier_type); - const auto& range = idx.equal_range(t); + auto const& range = idx.equal_range(t); size_t erased_hosts = 0; size_t erased_reservations = 0; for (auto key = range.first; key != range.second;) { diff --git a/src/lib/dhcpsrv/cfg_option.cc b/src/lib/dhcpsrv/cfg_option.cc index 4c1cddc069..c4b8f47021 100644 --- a/src/lib/dhcpsrv/cfg_option.cc +++ b/src/lib/dhcpsrv/cfg_option.cc @@ -162,7 +162,7 @@ CfgOption::createOptions(CfgOptionDefPtr cfg_def) { // Iterate over all the option descriptors in // all the spaces and instantiate the options // based on the given definitions. - for (const auto& space : getOptionSpaceNames()) { + for (auto const& space : getOptionSpaceNames()) { for (auto opt_desc : *(getAll(space))) { if (createDescriptorOption(cfg_def, space, opt_desc)) { // Option was recreated, let's replace the descriptor. @@ -372,7 +372,7 @@ CfgOption::del(const std::string& option_space, const uint16_t option_code) { (option_space != DHCP6_OPTION_SPACE)) { // For each option space name iterate over the existing options. auto option_space_names = getOptionSpaceNames(); - for (const auto& option_space_from_list : option_space_names) { + for (auto const& option_space_from_list : option_space_names) { // Get all options within the particular option space. auto options_in_space = getAll(option_space_from_list); for (auto option_it = options_in_space->begin(); diff --git a/src/lib/dhcpsrv/cfg_shared_networks.cc b/src/lib/dhcpsrv/cfg_shared_networks.cc index 75d7059e51..2393f5d74c 100644 --- a/src/lib/dhcpsrv/cfg_shared_networks.cc +++ b/src/lib/dhcpsrv/cfg_shared_networks.cc @@ -14,7 +14,7 @@ namespace dhcp { bool CfgSharedNetworks4::hasNetworkWithServerId(const IOAddress& server_id) const { - const auto& index = networks_.get(); + auto const& index = networks_.get(); auto network_it = index.find(server_id); return (network_it != index.cend()); } diff --git a/src/lib/dhcpsrv/cfg_shared_networks.h b/src/lib/dhcpsrv/cfg_shared_networks.h index a8de2f2047..a478220171 100644 --- a/src/lib/dhcpsrv/cfg_shared_networks.h +++ b/src/lib/dhcpsrv/cfg_shared_networks.h @@ -106,7 +106,7 @@ public: /// @return Pointer to the shared network or null pointer if the network /// is not found. SharedNetworkPtrType getByName(const std::string& name) const { - const auto& index = networks_.template get(); + auto const& index = networks_.template get(); auto shared_network = index.find(name); if (shared_network != index.cend()) { return (*shared_network); @@ -122,7 +122,7 @@ public: data::ElementPtr list = data::Element::createList(); // Insert shared networks sorted by their names into the list. - const auto& index = networks_.template get(); + auto const& index = networks_.template get(); for (auto shared_network = index.begin(); shared_network != index.end(); ++shared_network) { list->add((*shared_network)->toElement()); @@ -186,7 +186,7 @@ public: // Network exists, which means we're updating it. // First we need to move its subnets to the new // version of the network. - const auto subnets = (*existing_network)->getAllSubnets(); + auto const subnets = (*existing_network)->getAllSubnets(); auto copy_subnets(*subnets); for (auto subnet = copy_subnets.cbegin(); subnet != copy_subnets.cend(); ++subnet) { diff --git a/src/lib/dhcpsrv/cfg_subnets4.cc b/src/lib/dhcpsrv/cfg_subnets4.cc index 3e7c58bed5..3b581f966b 100644 --- a/src/lib/dhcpsrv/cfg_subnets4.cc +++ b/src/lib/dhcpsrv/cfg_subnets4.cc @@ -155,7 +155,7 @@ CfgSubnets4::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks, other_subnet->getCfgOption()->createOptions(cfg_def); // Create the options for pool based on the given definitions. - for (const auto& pool : other_subnet->getPoolsWritable(Lease::TYPE_V4)) { + for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_V4)) { pool->getCfgOption()->createOptions(cfg_def); } @@ -185,21 +185,21 @@ CfgSubnets4::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks, ConstSubnet4Ptr CfgSubnets4::getBySubnetId(const SubnetID& subnet_id) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(subnet_id); return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet4Ptr()); } ConstSubnet4Ptr CfgSubnets4::getByPrefix(const std::string& subnet_text) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(subnet_text); return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet4Ptr()); } bool CfgSubnets4::hasSubnetWithServerId(const asiolink::IOAddress& server_id) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(server_id); return (subnet_it != index.cend()); } @@ -535,7 +535,7 @@ CfgSubnets4::removeStatistics() { stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, "reclaimed-leases")); - for (const auto& pool : subnet4->getPools(Lease::TYPE_V4)) { + for (auto const& pool : subnet4->getPools(Lease::TYPE_V4)) { stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pool", pool->getID(), "total-addresses"))); @@ -592,7 +592,7 @@ CfgSubnets4::updateStatistics() { stats_mgr.setValue(name_conflicts, static_cast(0)); } - for (const auto& pool : subnet4->getPools(Lease::TYPE_V4)) { + for (auto const& pool : subnet4->getPools(Lease::TYPE_V4)) { const std::string& name_total(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pool", pool->getID(), "total-addresses"))); diff --git a/src/lib/dhcpsrv/cfg_subnets6.cc b/src/lib/dhcpsrv/cfg_subnets6.cc index bf2b6be519..179c5bd226 100644 --- a/src/lib/dhcpsrv/cfg_subnets6.cc +++ b/src/lib/dhcpsrv/cfg_subnets6.cc @@ -152,12 +152,12 @@ CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks, other_subnet->getCfgOption()->createOptions(cfg_def); // Create the options for pool based on the given definitions. - for (const auto& pool : other_subnet->getPoolsWritable(Lease::TYPE_NA)) { + for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_NA)) { pool->getCfgOption()->createOptions(cfg_def); } // Create the options for pd pool based on the given definitions. - for (const auto& pool : other_subnet->getPoolsWritable(Lease::TYPE_PD)) { + for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_PD)) { pool->getCfgOption()->createOptions(cfg_def); } @@ -187,14 +187,14 @@ CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks, ConstSubnet6Ptr CfgSubnets6::getBySubnetId(const SubnetID& subnet_id) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(subnet_id); return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet6Ptr()); } ConstSubnet6Ptr CfgSubnets6::getByPrefix(const std::string& subnet_text) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(subnet_text); return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet6Ptr()); } @@ -433,7 +433,7 @@ CfgSubnets6::removeStatistics() { stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, "reclaimed-leases")); - for (const auto& pool : subnet6->getPools(Lease::TYPE_NA)) { + for (auto const& pool : subnet6->getPools(Lease::TYPE_NA)) { stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pool", pool->getID(), "total-nas"))); @@ -459,7 +459,7 @@ CfgSubnets6::removeStatistics() { "reclaimed-leases"))); } - for (const auto& pool : subnet6->getPools(Lease::TYPE_PD)) { + for (auto const& pool : subnet6->getPools(Lease::TYPE_PD)) { stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pd-pool", pool->getID(), "total-pds"))); @@ -520,7 +520,7 @@ CfgSubnets6::updateStatistics() { stats_mgr.setValue(name_ia_pd_reuses, int64_t(0)); } - for (const auto& pool : subnet6->getPools(Lease::TYPE_NA)) { + for (auto const& pool : subnet6->getPools(Lease::TYPE_NA)) { const std::string& name_total_nas(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pool", pool->getID(), "total-nas"))); @@ -538,7 +538,7 @@ CfgSubnets6::updateStatistics() { } } - for (const auto& pool : subnet6->getPools(Lease::TYPE_PD)) { + for (auto const& pool : subnet6->getPools(Lease::TYPE_PD)) { const std::string& name_total_pds(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pd-pool", pool->getID(), "total-pds"))); diff --git a/src/lib/dhcpsrv/iterative_allocator.cc b/src/lib/dhcpsrv/iterative_allocator.cc index 6ec2b8c5bd..8f4dc11980 100644 --- a/src/lib/dhcpsrv/iterative_allocator.cc +++ b/src/lib/dhcpsrv/iterative_allocator.cc @@ -97,7 +97,7 @@ IterativeAllocator::pickAddressInternal(const ClientClasses& client_classes, bool valid = true; bool retrying = false; - const auto& pools = subnet_.lock()->getPools(pool_type_); + auto const& pools = subnet_.lock()->getPools(pool_type_); if (pools.empty()) { isc_throw(AllocFailed, "No pools defined in selected subnet"); @@ -210,7 +210,7 @@ IterativeAllocator::pickPrefixInternal(const ClientClasses& client_classes, bool valid = true; bool retrying = false; - const auto& pools = subnet_.lock()->getPools(pool_type_); + auto const& pools = subnet_.lock()->getPools(pool_type_); if (pools.empty()) { isc_throw(AllocFailed, "No pools defined in selected subnet"); diff --git a/src/lib/dhcpsrv/lease_mgr.cc b/src/lib/dhcpsrv/lease_mgr.cc index 00a3200341..f56a749de4 100644 --- a/src/lib/dhcpsrv/lease_mgr.cc +++ b/src/lib/dhcpsrv/lease_mgr.cc @@ -129,7 +129,7 @@ LeaseMgr::recountLeaseStats4() { stats_mgr.setValue(name_rec, zero); } - for (const auto& pool : (*subnet)->getPools(Lease::TYPE_V4)) { + for (auto const& pool : (*subnet)->getPools(Lease::TYPE_V4)) { const std::string name_aa(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pool", pool->getID(), "assigned-addresses"))); @@ -353,7 +353,7 @@ LeaseMgr::recountLeaseStats6() { zero); } - for (const auto& pool : (*subnet)->getPools(Lease::TYPE_NA)) { + for (auto const& pool : (*subnet)->getPools(Lease::TYPE_NA)) { const std::string& name_anas(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pool", pool->getID(), "assigned-nas"))); @@ -383,7 +383,7 @@ LeaseMgr::recountLeaseStats6() { } } - for (const auto& pool : (*subnet)->getPools(Lease::TYPE_PD)) { + for (auto const& pool : (*subnet)->getPools(Lease::TYPE_PD)) { const std::string& name_apds(StatsMgr::generateName("subnet", subnet_id, StatsMgr::generateName("pd-pool", pool->getID(), "assigned-pds"))); diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index 42d754c757..df812f144a 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -3321,7 +3321,7 @@ Memfile_LeaseMgr::buildExtendedInfoTables6() { size_t modified = 0; size_t processed = 0; - for (const auto& lease : storage6_) { + for (auto const& lease : storage6_) { ++leases; try { if (upgradeLease6ExtendedInfo(lease, check)) { @@ -3397,7 +3397,7 @@ Memfile_LeaseMgr::writeLeases4Internal(const std::string& filename) { ::rename(filename.c_str(), old.str().c_str()); CSVLeaseFile4 backup(filename); backup.open(); - for (const auto& lease : storage4_) { + for (auto const& lease : storage4_) { backup.append(*lease); } backup.close(); @@ -3434,7 +3434,7 @@ Memfile_LeaseMgr::writeLeases6Internal(const std::string& filename) { ::rename(filename.c_str(), old.str().c_str()); CSVLeaseFile6 backup(filename); backup.open(); - for (const auto& lease : storage6_) { + for (auto const& lease : storage6_) { backup.append(*lease); } backup.close(); diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc index 9a7092e7e5..1b71d52c57 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.cc +++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc @@ -4580,7 +4580,7 @@ MySqlLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& page_size) { ++pages; start_addr = leases.back()->addr_; - for (const auto& lease : leases) { + for (auto const& lease : leases) { try { bool modified = upgradeLease6ExtendedInfo(lease, check); if (modified) { diff --git a/src/lib/dhcpsrv/parsers/client_class_def_parser.cc b/src/lib/dhcpsrv/parsers/client_class_def_parser.cc index d84ca12a10..0d04293f05 100644 --- a/src/lib/dhcpsrv/parsers/client_class_def_parser.cc +++ b/src/lib/dhcpsrv/parsers/client_class_def_parser.cc @@ -251,7 +251,7 @@ ClientClassDefParser::parse(ClientClassDictionaryPtr& class_dictionary, } // Sanity checks on built-in classes - for (const auto& bn : builtinNames) { + for (auto const& bn : builtinNames) { if (name == bn) { if (required) { isc_throw(DhcpConfigError, "built-in class '" << name diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index 384369c1e4..c064227362 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -651,7 +651,7 @@ SubnetConfigParser::createSubnet(ConstElementPtr params) { initSubnet(params, addr, len); // Add pools to it. - for (const auto& pool : *pools_) { + for (auto const& pool : *pools_) { try { subnet_->addPool(pool); } catch (const BadValue& ex) { diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index a2d3fa4701..01718d9b5b 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -3622,7 +3622,7 @@ PgSqlLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& page_size) { ++pages; start_addr = leases.back()->addr_; - for (const auto& lease : leases) { + for (auto const& lease : leases) { try { bool modified = upgradeLease6ExtendedInfo(lease, check); if (modified) { diff --git a/src/lib/dhcpsrv/random_allocator.cc b/src/lib/dhcpsrv/random_allocator.cc index 5298078f6c..d74201bdf7 100644 --- a/src/lib/dhcpsrv/random_allocator.cc +++ b/src/lib/dhcpsrv/random_allocator.cc @@ -28,7 +28,7 @@ RandomAllocator::pickAddressInternal(const ClientClasses& client_classes, const IdentifierBaseTypePtr&, const IOAddress&) { auto subnet = subnet_.lock(); - const auto& pools = subnet->getPools(pool_type_); + auto const& pools = subnet->getPools(pool_type_); // Let's first iterate over the pools and identify the ones that // meet client class criteria. Then, segregate these pools into @@ -91,7 +91,7 @@ RandomAllocator::pickPrefixInternal(const ClientClasses& client_classes, const IOAddress&, uint8_t hint_prefix_length) { auto subnet = subnet_.lock(); - const auto& pools = subnet->getPools(pool_type_); + auto const& pools = subnet->getPools(pool_type_); // Let's first iterate over the pools and identify the ones that // meet client class criteria. Then, segragate these pools into diff --git a/src/lib/dhcpsrv/shared_network.cc b/src/lib/dhcpsrv/shared_network.cc index 2307dfe85c..1580b18d1f 100644 --- a/src/lib/dhcpsrv/shared_network.cc +++ b/src/lib/dhcpsrv/shared_network.cc @@ -158,7 +158,7 @@ public: template static SubnetPtrType getSubnet(const SubnetCollectionType& subnets, const SubnetID& subnet_id) { - const auto& index = subnets.template get(); + auto const& index = subnets.template get(); auto subnet_it = index.find(subnet_id); if (subnet_it != index.cend()) { return (*subnet_it); @@ -183,7 +183,7 @@ public: template static SubnetPtrType getSubnet(const SubnetCollectionType& subnets, const std::string& subnet_prefix) { - const auto& index = subnets.template get(); + auto const& index = subnets.template get(); auto subnet_it = index.find(subnet_prefix); if (subnet_it != index.cend()) { return (*subnet_it); @@ -245,7 +245,7 @@ public: // Need to retrieve an iterator to the current subnet first. The // subnet must exist in this container, thus we throw if the iterator // is not found. - const auto& index = subnets.template get(); + auto const& index = subnets.template get(); auto subnet_it = index.find(current_subnet); if (subnet_it == index.cend()) { isc_throw(BadValue, "no such subnet " << current_subnet diff --git a/src/lib/dhcpsrv/srv_config.cc b/src/lib/dhcpsrv/srv_config.cc index 5783eac252..a07f964fee 100644 --- a/src/lib/dhcpsrv/srv_config.cc +++ b/src/lib/dhcpsrv/srv_config.cc @@ -333,7 +333,7 @@ SrvConfig::applyDefaultsConfiguredGlobals(const SimpleDefaults& defaults) { const Element::Position pos("", 0, 0); // Let's go over all parameters we have defaults for. - for (const auto& def_value : defaults) { + for (auto const& def_value : defaults) { // Try if such a parameter is there. If it is, let's // skip it, because user knows best *cough*. diff --git a/src/lib/dhcpsrv/subnet.cc b/src/lib/dhcpsrv/subnet.cc index 0477fc17b1..9acf1211f4 100644 --- a/src/lib/dhcpsrv/subnet.cc +++ b/src/lib/dhcpsrv/subnet.cc @@ -406,7 +406,7 @@ const PoolPtr Subnet::getPool(Lease::Type type, const isc::asiolink::IOAddress& // check if the type is valid (and throw if it isn't) checkType(type); - const auto& pools = getPools(type); + auto const& pools = getPools(type); PoolPtr candidate; @@ -442,7 +442,7 @@ const PoolPtr Subnet::getPool(Lease::Type type, const isc::asiolink::IOAddress& void Subnet::initAllocatorsAfterConfigure() { - for (const auto& allocator : allocators_) { + for (auto const& allocator : allocators_) { allocator.second->initAfterConfigure(); } } @@ -453,7 +453,7 @@ const PoolPtr Subnet::getPool(Lease::Type type, // check if the type is valid (and throw if it isn't) checkType(type); - const auto& pools = getPools(type); + auto const& pools = getPools(type); PoolPtr candidate; @@ -543,8 +543,8 @@ Subnet::inPool(Lease::Type type, const isc::asiolink::IOAddress& addr) const { return (false); } - const auto& pools = getPools(type); - for (const auto& pool : pools) { + auto const& pools = getPools(type); + for (auto const& pool : pools) { if (pool->inRange(addr)) { return (true); } @@ -563,8 +563,8 @@ Subnet::inPool(Lease::Type type, return (false); } - const auto& pools = getPools(type); - for (const auto& pool : pools) { + auto const& pools = getPools(type); + for (auto const& pool : pools) { if (!pool->clientSupported(client_classes)) { continue; } @@ -578,7 +578,7 @@ Subnet::inPool(Lease::Type type, bool Subnet::poolOverlaps(const Lease::Type& pool_type, const PoolPtr& pool) const { - const auto& pools = getPools(pool_type); + auto const& pools = getPools(pool_type); // If no pools, we don't overlap. Nothing to do. if (pools.empty()) { @@ -599,7 +599,7 @@ Subnet::poolOverlaps(const Lease::Type& pool_type, const PoolPtr& pool) const { // greater than F2). prefixLessThanPoolAddress with the first argument // set to "true" is the custom comparison function for upper_bound, which // compares F2 with the first addresses of the existing pools. - const auto pool3_it = + auto const pool3_it = std::upper_bound(pools.begin(), pools.end(), pool->getFirstAddress(), prefixLessThanFirstAddress); @@ -810,9 +810,9 @@ Subnet4::toElement() const { isc::data::merge(map, d4o6.toElement()); // Set pools - const auto& pools = getPools(Lease::TYPE_V4); + auto const& pools = getPools(Lease::TYPE_V4); ElementPtr pool_list = Element::createList(); - for (const auto& pool : pools) { + for (auto const& pool : pools) { // Add the formatted pool to the list pool_list->add(pool->toElement()); } @@ -918,18 +918,18 @@ Subnet6::toElement() const { merge(map, network_map); // Set pools - const auto& pools = getPools(Lease::TYPE_NA); + auto const& pools = getPools(Lease::TYPE_NA); ElementPtr pool_list = Element::createList(); - for (const auto& pool : pools) { + for (auto const& pool : pools) { // Add the formatted pool to the list pool_list->add(pool->toElement()); } map->set("pools", pool_list); // Set pd-pools - const auto& pdpools = getPools(Lease::TYPE_PD); + auto const& pdpools = getPools(Lease::TYPE_PD); ElementPtr pdpool_list = Element::createList(); - for (const auto& pool : pdpools) { + for (auto const& pool : pdpools) { // Add the formatted pool to the list pdpool_list->add(pool->toElement()); } diff --git a/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc b/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc index 8706767a0e..15b0c97f3f 100644 --- a/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc +++ b/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc @@ -174,7 +174,7 @@ public: /// @param object_type Object type. bool hasConfigElement(const std::string& object_type) const { if (!audit_entries_.empty()) { - const auto& index = audit_entries_.get(); + auto const& index = audit_entries_.get(); auto range = index.equal_range(object_type); for (auto it = range.first; it != range.second; ++it) { if (((*it)->getModificationType() != AuditEntry::ModificationType::DELETE)) { @@ -195,7 +195,7 @@ public: bool deleteConfigElement(const std::string& object_type, const uint64_t object_id) const { if (!audit_entries_.empty()) { - const auto& index = audit_entries_.get(); + auto const& index = audit_entries_.get(); auto range = index.equal_range(boost::make_tuple(object_type, AuditEntry::ModificationType::DELETE)); for (auto it = range.first; it != range.second; ++it) { diff --git a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc index f34b308dd6..5eff523f55 100644 --- a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc @@ -187,7 +187,7 @@ public: /// @brief Remove other files. void removeOtherFiles() const { - for (const auto& file : extra_files_) { + for (auto const& file : extra_files_) { LeaseFileIO io(file); io.removeFile(); } diff --git a/src/lib/dhcpsrv/tests/shared_network_unittest.cc b/src/lib/dhcpsrv/tests/shared_network_unittest.cc index 00a42b0ebe..ea200016d3 100644 --- a/src/lib/dhcpsrv/tests/shared_network_unittest.cc +++ b/src/lib/dhcpsrv/tests/shared_network_unittest.cc @@ -404,7 +404,7 @@ TEST(SharedNetwork4Test, getNextSubnet) { if (j < subnets.size() - 1) { ASSERT_TRUE(s) << "retrieving next subnet failed for pair of" " indexes (i, j) = (" << i << ", " << j << ")"; - const auto expected_subnet_id = (i + j + 1) % subnets.size() + 1; + auto const expected_subnet_id = (i + j + 1) % subnets.size() + 1; EXPECT_EQ(expected_subnet_id, s->getID()); } else { // Null subnet returned for a last iteration. @@ -1154,7 +1154,7 @@ TEST(SharedNetwork6Test, getNextSubnet) { if (j < subnets.size() - 1) { ASSERT_TRUE(s) << "retrieving next subnet failed for pair of" " indexes (i, j) = (" << i << ", " << j << ")"; - const auto expected_subnet_id = (i + j + 1) % subnets.size() + 1; + auto const expected_subnet_id = (i + j + 1) % subnets.size() + 1; EXPECT_EQ(expected_subnet_id, s->getID()); } else { // Null subnet returned for a last iteration. diff --git a/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc b/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc index f10d3e87f9..55540e0aae 100644 --- a/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc @@ -144,7 +144,7 @@ GenericBackendTest::testNewAuditEntry(const std::string& exp_object_type, // Server tag is 'all'. tag = "all"; } else { - const auto& tags = server_selector.getTags(); + auto const& tags = server_selector.getTags(); // This test is not meant to handle multiple server tags all at once. if (tags.size() > 1) { ADD_FAILURE() << "Test error: do not use multiple server tags"; @@ -191,7 +191,7 @@ GenericBackendTest::testNewAuditEntry(const std::vector& exp_entr // Server tag is 'all'. tag = "all"; } else { - const auto& tags = server_selector.getTags(); + auto const& tags = server_selector.getTags(); // This test is not meant to handle multiple server tags all at once. if (tags.size() != 1) { ADD_FAILURE() << "Test error: tags.size(): " << tags.size() diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc index 8ab8df7616..4d71fce430 100644 --- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc @@ -886,7 +886,7 @@ GenericConfigBackendDHCPv4Test::getAllGlobalParameters4Test() { auto parameters = cbptr_->getAllGlobalParameters4(ServerSelector::ALL()); ASSERT_EQ(5, parameters.size()); - const auto& parameters_index = parameters.get(); + auto const& parameters_index = parameters.get(); // Verify their values. EXPECT_EQ("value1", (*parameters_index.find("name1"))->getValue()); @@ -939,7 +939,7 @@ GenericConfigBackendDHCPv4Test::getModifiedGlobalParameters4Test() { auto parameters = cbptr_->getModifiedGlobalParameters4(ServerSelector::ALL(), timestamps_["after today"]); - const auto& parameters_index = parameters.get(); + auto const& parameters_index = parameters.get(); // It should be the one modified "tomorrow". ASSERT_EQ(1, parameters_index.size()); diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc index 584f2998ec..62985934c5 100644 --- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc @@ -918,7 +918,7 @@ GenericConfigBackendDHCPv6Test::getAllGlobalParameters6Test() { auto parameters = cbptr_->getAllGlobalParameters6(ServerSelector::ALL()); ASSERT_EQ(5, parameters.size()); - const auto& parameters_index = parameters.get(); + auto const& parameters_index = parameters.get(); // Verify their values. EXPECT_EQ("value1", (*parameters_index.find("name1"))->getValue()); @@ -971,7 +971,7 @@ GenericConfigBackendDHCPv6Test::getModifiedGlobalParameters6Test() { auto parameters = cbptr_->getModifiedGlobalParameters6(ServerSelector::ALL(), timestamps_["after today"]); - const auto& parameters_index = parameters.get(); + auto const& parameters_index = parameters.get(); // It should be the one modified "tomorrow". ASSERT_EQ(1, parameters_index.size()); diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc index 0920bc4bba..f3caa3f8c6 100644 --- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc @@ -5352,7 +5352,7 @@ HostMgrTest::testDelete6ByIDAndIdentifier(BaseHostDataSource& data_source1, } bool HostMgrTest::isPrimaryDataSource(const BaseHostDataSource& data_source) const { - const auto ptr = dynamic_cast(&data_source); + auto const ptr = dynamic_cast(&data_source); return ptr != nullptr; } diff --git a/src/lib/dhcpsrv/testutils/memory_host_data_source.cc b/src/lib/dhcpsrv/testutils/memory_host_data_source.cc index 7b6bd22c03..ef1b2bcd64 100644 --- a/src/lib/dhcpsrv/testutils/memory_host_data_source.cc +++ b/src/lib/dhcpsrv/testutils/memory_host_data_source.cc @@ -179,7 +179,7 @@ MemHostDataSource::getPage6(size_t& /*source_index*/, ConstHostCollection MemHostDataSource::getAll4(const asiolink::IOAddress& address) const { ConstHostCollection hosts; - for (const auto & h : store_) { + for (auto const & h : store_) { if (h->getIPv4Reservation() == address) { hosts.push_back(h); } @@ -250,7 +250,7 @@ ConstHostCollection MemHostDataSource::getAll4(const SubnetID& subnet_id, const asiolink::IOAddress& address) const { ConstHostCollection hosts; - for (const auto & h : store_) { + for (auto const & h : store_) { if (h->getIPv4SubnetID() == subnet_id && h->getIPv4Reservation() == address) { hosts.push_back(h); @@ -296,7 +296,7 @@ ConstHostCollection MemHostDataSource::getAll6(const SubnetID& subnet_id, const asiolink::IOAddress& address) const { ConstHostCollection hosts; - for (const auto & h : store_) { + for (auto const & h : store_) { if (h->getIPv6SubnetID() != subnet_id) { continue; } @@ -315,7 +315,7 @@ MemHostDataSource::getAll6(const SubnetID& subnet_id, ConstHostCollection MemHostDataSource::getAll6(const asiolink::IOAddress& address) const { ConstHostCollection hosts; - for (const auto & h : store_) { + for (auto const & h : store_) { auto resrvs = h->getIPv6Reservations(); for (auto r = resrvs.first; r != resrvs.second; ++r) { if ((*r).second.getPrefix() == address) { diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc index a3cfcbd1c8..98be2a1337 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc @@ -37,7 +37,7 @@ TestConfigBackendDHCPv4::unregisterBackendType(ConfigBackendDHCPv4Mgr& mgr, Subnet4Ptr TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector, const std::string& subnet_prefix) const{ - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(subnet_prefix); if (subnet_it == index.cend()) { return (Subnet4Ptr()); @@ -61,7 +61,7 @@ TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector, Subnet4Ptr TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector, const SubnetID& subnet_id) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(subnet_id); if (subnet_it == index.cend()) { return (Subnet4Ptr()); @@ -118,7 +118,7 @@ TestConfigBackendDHCPv4::getAllSubnets4(const db::ServerSelector& server_selecto Subnet4Collection TestConfigBackendDHCPv4::getModifiedSubnets4(const db::ServerSelector& server_selector, const boost::posix_time::ptime& modification_time) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); Subnet4Collection subnets; auto lb = index.lower_bound(modification_time); for (auto subnet = lb; subnet != index.end(); ++subnet) { @@ -197,7 +197,7 @@ TestConfigBackendDHCPv4::getSharedNetworkSubnets4(const db::ServerSelector& serv SharedNetwork4Ptr TestConfigBackendDHCPv4::getSharedNetwork4(const db::ServerSelector& server_selector, const std::string& name) const { - const auto& index = shared_networks_.get(); + auto const& index = shared_networks_.get(); auto network_it = index.find(name); if (network_it == index.cend()) { return (SharedNetwork4Ptr()); @@ -254,7 +254,7 @@ TestConfigBackendDHCPv4::getAllSharedNetworks4(const db::ServerSelector& server_ SharedNetwork4Collection TestConfigBackendDHCPv4::getModifiedSharedNetworks4(const db::ServerSelector& server_selector, const boost::posix_time::ptime& modification_time) const { - const auto& index = shared_networks_.get(); + auto const& index = shared_networks_.get(); SharedNetwork4Collection shared_networks; auto lb = index.lower_bound(modification_time); for (auto shared_network = lb; shared_network != index.end(); ++shared_network) { @@ -293,7 +293,7 @@ TestConfigBackendDHCPv4::getOptionDef4(const db::ServerSelector& server_selector const std::string& space) const { auto tags = server_selector.getTags(); auto candidate = OptionDefinitionPtr(); - const auto& index = option_defs_.get<1>(); + auto const& index = option_defs_.get<1>(); auto option_def_it_pair = index.equal_range(code); for (auto option_def_it = option_def_it_pair.first; @@ -348,7 +348,7 @@ TestConfigBackendDHCPv4::getModifiedOptionDefs4(const db::ServerSelector& server const boost::posix_time::ptime& modification_time) const { auto tags = server_selector.getTags(); OptionDefContainer option_defs; - const auto& index = option_defs_.get<3>(); + auto const& index = option_defs_.get<3>(); auto lb = index.lower_bound(modification_time); for (auto option_def = lb; option_def != index.end(); ++option_def) { bool got = false; @@ -375,7 +375,7 @@ TestConfigBackendDHCPv4::getOption4(const db::ServerSelector& server_selector, const std::string& space) const { auto tags = server_selector.getTags(); auto candidate = OptionDescriptorPtr(); - const auto& index = options_.get<1>(); + auto const& index = options_.get<1>(); auto option_it_pair = index.equal_range(code); for (auto option_it = option_it_pair.first; option_it != option_it_pair.second; @@ -423,7 +423,7 @@ TestConfigBackendDHCPv4::getModifiedOptions4(const db::ServerSelector& server_se const boost::posix_time::ptime& modification_time) const { auto tags = server_selector.getTags(); OptionContainer options; - const auto& index = options_.get<3>(); + auto const& index = options_.get<3>(); auto lb = index.lower_bound(modification_time); for (auto option = lb; option != index.end(); ++option) { bool got = false; @@ -449,7 +449,7 @@ TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_se const std::string& name) const { auto tags = server_selector.getTags(); auto candidate = StampedValuePtr(); - const auto& index = globals_.get(); + auto const& index = globals_.get(); auto global_range = index.equal_range(name); for (auto global_it = global_range.first; global_it != global_range.second; ++global_it) { @@ -495,7 +495,7 @@ TestConfigBackendDHCPv4::getModifiedGlobalParameters4(const db::ServerSelector& const boost::posix_time::ptime& modification_time) const { auto tags = server_selector.getTags(); StampedValueCollection globals; - const auto& index = globals_.get(); + auto const& index = globals_.get(); auto lb = index.lower_bound(modification_time); for (auto global = lb; global != index.end(); ++global) { bool got = false; @@ -658,7 +658,7 @@ TestConfigBackendDHCPv4::getAllServers4() const { ServerPtr TestConfigBackendDHCPv4::getServer4(const ServerTag& server_tag) const { - const auto& index = servers_.get(); + auto const& index = servers_.get(); auto server_it = index.find(server_tag.get()); return ((server_it != index.cend()) ? (*server_it) : ServerPtr()); } diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc index cd9045bfe3..9a3fe1d6d7 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc @@ -36,7 +36,7 @@ TestConfigBackendDHCPv6::unregisterBackendType(ConfigBackendDHCPv6Mgr& mgr, Subnet6Ptr TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector, const std::string& subnet_prefix) const{ - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(subnet_prefix); if (subnet_it == index.cend()) { return (Subnet6Ptr()); @@ -60,7 +60,7 @@ TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector, Subnet6Ptr TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector, const SubnetID& subnet_id) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); auto subnet_it = index.find(subnet_id); if (subnet_it == index.cend()) { return (Subnet6Ptr()); @@ -117,7 +117,7 @@ TestConfigBackendDHCPv6::getAllSubnets6(const db::ServerSelector& server_selecto Subnet6Collection TestConfigBackendDHCPv6::getModifiedSubnets6(const db::ServerSelector& server_selector, const boost::posix_time::ptime& modification_time) const { - const auto& index = subnets_.get(); + auto const& index = subnets_.get(); Subnet6Collection subnets; auto lb = index.lower_bound(modification_time); for (auto subnet = lb; subnet != index.end(); ++subnet) { @@ -196,7 +196,7 @@ TestConfigBackendDHCPv6::getSharedNetworkSubnets6(const db::ServerSelector& serv SharedNetwork6Ptr TestConfigBackendDHCPv6::getSharedNetwork6(const db::ServerSelector& server_selector, const std::string& name) const { - const auto& index = shared_networks_.get(); + auto const& index = shared_networks_.get(); auto network_it = index.find(name); if (network_it == index.cend()) { return (SharedNetwork6Ptr()); @@ -253,7 +253,7 @@ TestConfigBackendDHCPv6::getAllSharedNetworks6(const db::ServerSelector& server_ SharedNetwork6Collection TestConfigBackendDHCPv6::getModifiedSharedNetworks6(const db::ServerSelector& server_selector, const boost::posix_time::ptime& modification_time) const { - const auto& index = shared_networks_.get(); + auto const& index = shared_networks_.get(); SharedNetwork6Collection shared_networks; auto lb = index.lower_bound(modification_time); for (auto shared_network = lb; shared_network != index.end(); ++shared_network) { @@ -292,7 +292,7 @@ TestConfigBackendDHCPv6::getOptionDef6(const db::ServerSelector& server_selector const std::string& space) const { auto tags = server_selector.getTags(); auto candidate = OptionDefinitionPtr(); - const auto& index = option_defs_.get<1>(); + auto const& index = option_defs_.get<1>(); auto option_def_it_pair = index.equal_range(code); for (auto option_def_it = option_def_it_pair.first; @@ -347,7 +347,7 @@ TestConfigBackendDHCPv6::getModifiedOptionDefs6(const db::ServerSelector& server const boost::posix_time::ptime& modification_time) const { auto tags = server_selector.getTags(); OptionDefContainer option_defs; - const auto& index = option_defs_.get<3>(); + auto const& index = option_defs_.get<3>(); auto lb = index.lower_bound(modification_time); for (auto option_def = lb; option_def != index.end(); ++option_def) { bool got = false; @@ -374,7 +374,7 @@ TestConfigBackendDHCPv6::getOption6(const db::ServerSelector& server_selector, const std::string& space) const { auto tags = server_selector.getTags(); auto candidate = OptionDescriptorPtr(); - const auto& index = options_.get<1>(); + auto const& index = options_.get<1>(); auto option_it_pair = index.equal_range(code); for (auto option_it = option_it_pair.first; option_it != option_it_pair.second; @@ -422,7 +422,7 @@ TestConfigBackendDHCPv6::getModifiedOptions6(const db::ServerSelector& server_se const boost::posix_time::ptime& modification_time) const { auto tags = server_selector.getTags(); OptionContainer options; - const auto& index = options_.get<3>(); + auto const& index = options_.get<3>(); auto lb = index.lower_bound(modification_time); for (auto option = lb; option != index.end(); ++option) { bool got = false; @@ -448,7 +448,7 @@ TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_se const std::string& name) const { auto tags = server_selector.getTags(); auto candidate = StampedValuePtr(); - const auto& index = globals_.get(); + auto const& index = globals_.get(); auto global_range = index.equal_range(name); for (auto global_it = global_range.first; global_it != global_range.second; ++global_it) { @@ -494,7 +494,7 @@ TestConfigBackendDHCPv6::getModifiedGlobalParameters6(const db::ServerSelector& const boost::posix_time::ptime& modification_time) const { auto tags = server_selector.getTags(); StampedValueCollection globals; - const auto& index = globals_.get(); + auto const& index = globals_.get(); auto lb = index.lower_bound(modification_time); for (auto global = lb; global != index.end(); ++global) { bool got = false; @@ -657,7 +657,7 @@ TestConfigBackendDHCPv6::getAllServers6() const { ServerPtr TestConfigBackendDHCPv6::getServer6(const ServerTag& server_tag) const { - const auto& index = servers_.get(); + auto const& index = servers_.get(); auto server_it = index.find(server_tag.get()); return ((server_it != index.cend()) ? (*server_it) : ServerPtr()); } diff --git a/src/lib/http/basic_auth_config.cc b/src/lib/http/basic_auth_config.cc index 1d70995e32..cff5ecb6cc 100644 --- a/src/lib/http/basic_auth_config.cc +++ b/src/lib/http/basic_auth_config.cc @@ -362,7 +362,7 @@ BasicHttpAuthConfig::checkAuth(const HttpResponseCreator& creator, value = value.substr(5); value = str::trim(value); // Verify the credential is in the list. - const auto it = credentials.find(value); + auto const it = credentials.find(value); if (it != credentials.end()) { LOG_INFO(auth_logger, HTTP_CLIENT_REQUEST_AUTHORIZED) .arg(it->second); diff --git a/src/lib/http/tests/client_mt_unittests.cc b/src/lib/http/tests/client_mt_unittests.cc index ef04c28c60..e2fabf8136 100644 --- a/src/lib/http/tests/client_mt_unittests.cc +++ b/src/lib/http/tests/client_mt_unittests.cc @@ -213,7 +213,7 @@ public: } // Stop all listeners. - for (const auto& listener : listeners_) { + for (auto const& listener : listeners_) { listener->stop(); } @@ -518,7 +518,7 @@ public: ASSERT_NO_THROW(client_->stop()); // Listeners should stop without issue. - for (const auto& listener : listeners_) { + for (auto const& listener : listeners_) { ASSERT_NO_THROW(listener->stop()); } @@ -713,7 +713,7 @@ public: ASSERT_NO_THROW(client_->stop()); // Listeners should stop without issue. - for (const auto& listener : listeners_) { + for (auto const& listener : listeners_) { ASSERT_NO_THROW(listener->stop()); } diff --git a/src/lib/pgsql/tests/pgsql_connection_unittest.cc b/src/lib/pgsql/tests/pgsql_connection_unittest.cc index 871a264992..4c73066c92 100644 --- a/src/lib/pgsql/tests/pgsql_connection_unittest.cc +++ b/src/lib/pgsql/tests/pgsql_connection_unittest.cc @@ -162,7 +162,7 @@ public: /// @param insert_rows Collection of rows of data to insert. Note that /// each row is inserted as a separate statement execution. void testInsert(const TestRowSet& insert_rows) { - for (const auto& row : insert_rows) { + for (auto const& row : insert_rows) { // Set the insert parameters based on the current insert row. PsqlBindArray in_bindings; in_bindings.add(row.int_col); @@ -238,7 +238,7 @@ public: /// @param update_rows Collection of rows of data to update. void testUpdate(const TestRowSet& update_rows) { size_t update_count = 0; - for (const auto& row : update_rows) { + for (auto const& row : update_rows) { // Set the text value and where clause parameters based on the // this row's values. PsqlBindArray in_bindings; diff --git a/src/lib/process/cb_ctl_base.h b/src/lib/process/cb_ctl_base.h index 28a3457d33..b333d5463c 100644 --- a/src/lib/process/cb_ctl_base.h +++ b/src/lib/process/cb_ctl_base.h @@ -269,7 +269,7 @@ protected: fetchConfigElement(const db::AuditEntryCollection& audit_entries, const std::string& object_type) const { db::AuditEntryCollection result; - const auto& index = audit_entries.get(); + auto const& index = audit_entries.get(); auto range = index.equal_range(object_type); for (auto it = range.first; it != range.second; ++it) { if ((*it)->getModificationType() != db::AuditEntry::ModificationType::DELETE) { @@ -346,7 +346,7 @@ protected: // Get the audit entries sorted by modification time and id, // and pick the latest entry. - const auto& index = audit_entries.get(); + auto const& index = audit_entries.get(); last_audit_revision_time_ = (*index.rbegin())->getModificationTime(); last_audit_revision_id_ = (*index.rbegin())->getRevisionId(); } @@ -370,7 +370,7 @@ protected: inline bool hasObjectId(const db::AuditEntryCollection& audit_entries, const uint64_t& object_id) { - const auto& object_id_idx = audit_entries.get(); + auto const& object_id_idx = audit_entries.get(); return (object_id_idx.count(object_id) > 0); } diff --git a/src/lib/process/redact_config.cc b/src/lib/process/redact_config.cc index 686620e324..2f4d6a5091 100644 --- a/src/lib/process/redact_config.cc +++ b/src/lib/process/redact_config.cc @@ -46,7 +46,7 @@ redact(ElementPtrType const& element, list json_path) { if (next_key == "*" || json_path.empty()) { // Then iterate through all the children. result = Element::createMap(); - for (const auto& kv : element->mapValue()) { + for (auto const& kv : element->mapValue()) { std::string const& key(kv.first); ConstElementPtr const& value(kv.second); diff --git a/src/lib/process/tests/cb_ctl_base_unittests.cc b/src/lib/process/tests/cb_ctl_base_unittests.cc index 6c6710944c..4f244db171 100644 --- a/src/lib/process/tests/cb_ctl_base_unittests.cc +++ b/src/lib/process/tests/cb_ctl_base_unittests.cc @@ -51,7 +51,7 @@ public: db::AuditEntryCollection filtered_entries; // Use the index which orders the audit entries by timestamps. - const auto& index = audit_entries_.get(); + auto const& index = audit_entries_.get(); // Locate the first audit entry after the last one having the // specified modification time and id. diff --git a/src/lib/stats/context.cc b/src/lib/stats/context.cc index 2a560efafd..399f5bf1ed 100644 --- a/src/lib/stats/context.cc +++ b/src/lib/stats/context.cc @@ -80,7 +80,7 @@ StatContext::getAll() const { void StatContext::setMaxSampleCountAll(uint32_t max_samples) { // Let's iterate over all stored statistics... - for (const auto& s : stats_) { + for (auto const& s : stats_) { // ... and set count limit for each statistic. s.second->setMaxSampleCount(max_samples); } diff --git a/src/lib/stats/testutils/stats_test_utils.h b/src/lib/stats/testutils/stats_test_utils.h index 3a3786ae5d..c730b9c3c0 100644 --- a/src/lib/stats/testutils/stats_test_utils.h +++ b/src/lib/stats/testutils/stats_test_utils.h @@ -61,7 +61,7 @@ inline void checkNoStat(const std::string& name) { /// /// @param expected_stats Map of expected static names and values. inline void checkStats(const StatMap& expected_stats) { - for (const auto& it : expected_stats) { + for (auto const& it : expected_stats) { checkStat(it.first, it.second); } } diff --git a/src/lib/tcp/tcp_connection_pool.cc b/src/lib/tcp/tcp_connection_pool.cc index d5fe61018a..b7de361c88 100644 --- a/src/lib/tcp/tcp_connection_pool.cc +++ b/src/lib/tcp/tcp_connection_pool.cc @@ -113,8 +113,8 @@ TcpConnectionPool::usedByRemoteIpInternal(const IOAddress& remote_ip, size_t& total_connections) { total_connections = connections_.size(); size_t cnt = 0; - for (const auto& conn : connections_) { - const auto& ep = conn->getRemoteEndpoint(); + for (auto const& conn : connections_) { + auto const& ep = conn->getRemoteEndpoint(); if ((ep != TcpConnection::NO_ENDPOINT()) && (IOAddress(ep.address()) == remote_ip)) { ++cnt; diff --git a/src/lib/testutils/gtest_utils.h b/src/lib/testutils/gtest_utils.h index 66a88fa282..6d526482e5 100644 --- a/src/lib/testutils/gtest_utils.h +++ b/src/lib/testutils/gtest_utils.h @@ -101,7 +101,7 @@ namespace test { #define SKIP_IF(expression) \ { \ if (expression) { \ - const auto info = ::testing::UnitTest::GetInstance()->current_test_info(); \ + auto const info = ::testing::UnitTest::GetInstance()->current_test_info(); \ std::cerr << "SKIPPING: " << info->test_case_name() << ":" << info->name() \ << ": '" << #expression << "' is true" << std::endl; \ return; \ @@ -111,7 +111,7 @@ namespace test { #define SKIP_IF(expression) \ { \ if (expression) { \ - const auto info = ::testing::UnitTest::GetInstance()->current_test_info(); \ + auto const info = ::testing::UnitTest::GetInstance()->current_test_info(); \ GTEST_SKIP() << "SKIPPING: " << info->test_case_name() << ":" << info->name() \ << ": '" << #expression << "' is true"; \ } \ diff --git a/src/lib/util/multi_threading_mgr.cc b/src/lib/util/multi_threading_mgr.cc index 043b42d5a4..cf3eaa8b67 100644 --- a/src/lib/util/multi_threading_mgr.cc +++ b/src/lib/util/multi_threading_mgr.cc @@ -154,7 +154,7 @@ MultiThreadingMgr::apply(bool enabled, uint32_t thread_count, uint32_t queue_siz void MultiThreadingMgr::checkCallbacksPermissions() { if (getMode()) { - for (const auto& cb : cs_callbacks_.getCallbackSets()) { + for (auto const& cb : cs_callbacks_.getCallbackSets()) { try { (cb.check_cb_)(); } catch (const isc::MultiThreadingInvalidOperation& ex) { @@ -177,7 +177,7 @@ MultiThreadingMgr::checkCallbacksPermissions() { void MultiThreadingMgr::callEntryCallbacks() { if (getMode()) { - const auto& callbacks = cs_callbacks_.getCallbackSets(); + auto const& callbacks = cs_callbacks_.getCallbackSets(); for (auto cb_it = callbacks.begin(); cb_it != callbacks.end(); cb_it++) { try { (cb_it->entry_cb_)(); @@ -193,7 +193,7 @@ MultiThreadingMgr::callEntryCallbacks() { void MultiThreadingMgr::callExitCallbacks() { if (getMode()) { - const auto& callbacks = cs_callbacks_.getCallbackSets(); + auto const& callbacks = cs_callbacks_.getCallbackSets(); for (auto cb_it = callbacks.rbegin(); cb_it != callbacks.rend(); cb_it++) { try { (cb_it->exit_cb_)(); diff --git a/src/lib/util/strutil.h b/src/lib/util/strutil.h index e5d2496a80..4182692efe 100644 --- a/src/lib/util/strutil.h +++ b/src/lib/util/strutil.h @@ -365,7 +365,7 @@ typedef boost::shared_ptr StringSanitizerPtr; /// @return True if empty or contains only printable characters, False otherwise inline bool isPrintable(const std::string& content) { - for (const auto& ch : content) { + for (auto const& ch : content) { if (isprint(static_cast(ch)) == 0) { return (false); } @@ -380,7 +380,7 @@ isPrintable(const std::string& content) { /// @return True if empty or contains only printable characters, False otherwise inline bool isPrintable(const std::vector& content) { - for (const auto& ch : content) { + for (auto const& ch : content) { if (isprint(static_cast(ch)) == 0) { return (false); } diff --git a/src/lib/util/tests/thread_pool_unittest.cc b/src/lib/util/tests/thread_pool_unittest.cc index 0c0df198f6..fc9d9381cf 100644 --- a/src/lib/util/tests/thread_pool_unittest.cc +++ b/src/lib/util/tests/thread_pool_unittest.cc @@ -130,7 +130,7 @@ public: // signal threads that are waiting signalThreads(); // wait for all test threads to exit - for (const auto& thread : threads_) { + for (auto const& thread : threads_) { thread->join(); } // reset all threads @@ -172,7 +172,7 @@ public: void checkRunHistory(uint32_t items_count) { uint32_t count = 0; // iterate over all threads history and count all the processed tasks - for (const auto& element : history_) { + for (auto const& element : history_) { count += element.second.size(); } ASSERT_EQ(count, items_count); diff --git a/src/lib/util/thread_pool.h b/src/lib/util/thread_pool.h index 379cb93b64..db2d415bca 100644 --- a/src/lib/util/thread_pool.h +++ b/src/lib/util/thread_pool.h @@ -242,7 +242,7 @@ private: isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by worker thread"); } queue_.disable(); - for (const auto& thread : threads_) { + for (auto const& thread : threads_) { thread->join(); } threads_.clear(); @@ -252,7 +252,7 @@ private: /// /// @return true if thread is owned, false otherwise bool checkThreadId(std::thread::id id) { - for (const auto& thread : threads_) { + for (auto const& thread : threads_) { if (id == thread->get_id()) { return (true); } diff --git a/src/lib/yang/tests/translator_utils_unittests.cc b/src/lib/yang/tests/translator_utils_unittests.cc index 11f3c4ab25..dc05164da9 100644 --- a/src/lib/yang/tests/translator_utils_unittests.cc +++ b/src/lib/yang/tests/translator_utils_unittests.cc @@ -280,7 +280,7 @@ void sanityCheckConfig(const string& model, const YRTree& tree) { // This is test environment sanity check. It verifies that all configuration // defined in yang_configs.h are sane. TEST(YangReprTest, verifyConfigs) { - for (const auto& x : TEST_CONFIGS) { + for (auto const& x : TEST_CONFIGS) { sanityCheckConfig(x.first, x.second); } }