diff options
author | Francis Dupont <fdupont@isc.org> | 2020-07-31 20:36:27 +0200 |
---|---|---|
committer | Tomek Mrugalski <tomek@isc.org> | 2020-08-13 15:54:14 +0200 |
commit | 0680e3e01c14fd44441c3614343c8b952f6797b2 (patch) | |
tree | 7f4e0afa6bc91ccfb4759315d58e9d59dc537771 | |
parent | [#1308] Less _1 ambiguities (diff) | |
download | kea-0680e3e01c14fd44441c3614343c8b952f6797b2.tar.xz kea-0680e3e01c14fd44441c3614343c8b952f6797b2.zip |
[#1308] No _1 ambiguities
36 files changed, 188 insertions, 185 deletions
diff --git a/src/bin/agent/ca_controller.cc b/src/bin/agent/ca_controller.cc index 092d102b76..121458f994 100644 --- a/src/bin/agent/ca_controller.cc +++ b/src/bin/agent/ca_controller.cc @@ -13,7 +13,7 @@ #include <functional> using namespace isc::process; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace isc { namespace agent { @@ -53,31 +53,31 @@ CtrlAgentController::parseFile(const std::string& name) { void CtrlAgentController::registerCommands() { CtrlAgentCommandMgr::instance().registerCommand(BUILD_REPORT_COMMAND, - std::bind(&DControllerBase::buildReportHandler, this, _1, _2)); + std::bind(&DControllerBase::buildReportHandler, this, ph::_1, ph::_2)); CtrlAgentCommandMgr::instance().registerCommand(CONFIG_GET_COMMAND, - std::bind(&DControllerBase::configGetHandler, this, _1, _2)); + std::bind(&DControllerBase::configGetHandler, this, ph::_1, ph::_2)); CtrlAgentCommandMgr::instance().registerCommand(CONFIG_RELOAD_COMMAND, - std::bind(&DControllerBase::configReloadHandler, this, _1, _2)); + std::bind(&DControllerBase::configReloadHandler, this, ph::_1, ph::_2)); CtrlAgentCommandMgr::instance().registerCommand(CONFIG_SET_COMMAND, - std::bind(&DControllerBase::configSetHandler, this, _1, _2)); + std::bind(&DControllerBase::configSetHandler, this, ph::_1, ph::_2)); CtrlAgentCommandMgr::instance().registerCommand(CONFIG_TEST_COMMAND, - std::bind(&DControllerBase::configTestHandler, this, _1, _2)); + std::bind(&DControllerBase::configTestHandler, this, ph::_1, ph::_2)); CtrlAgentCommandMgr::instance().registerCommand(CONFIG_WRITE_COMMAND, - std::bind(&DControllerBase::configWriteHandler, this, _1, _2)); + std::bind(&DControllerBase::configWriteHandler, this, ph::_1, ph::_2)); CtrlAgentCommandMgr::instance().registerCommand(SHUT_DOWN_COMMAND, - std::bind(&DControllerBase::shutdownHandler, this, _1, _2)); + std::bind(&DControllerBase::shutdownHandler, this, ph::_1, ph::_2)); CtrlAgentCommandMgr::instance().registerCommand(STATUS_GET_COMMAND, - std::bind(&DControllerBase::statusGetHandler, this, _1, _2)); + std::bind(&DControllerBase::statusGetHandler, this, ph::_1, ph::_2)); CtrlAgentCommandMgr::instance().registerCommand(VERSION_GET_COMMAND, - std::bind(&DControllerBase::versionGetHandler, this, _1, _2)); + std::bind(&DControllerBase::versionGetHandler, this, ph::_1, ph::_2)); } void diff --git a/src/bin/agent/tests/ca_response_creator_unittests.cc b/src/bin/agent/tests/ca_response_creator_unittests.cc index 73a6769751..2af027f964 100644 --- a/src/bin/agent/tests/ca_response_creator_unittests.cc +++ b/src/bin/agent/tests/ca_response_creator_unittests.cc @@ -19,7 +19,7 @@ using namespace isc::agent; using namespace isc::config; using namespace isc::data; using namespace isc::http; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -40,7 +40,7 @@ public: CtrlAgentCommandMgr::instance(). registerCommand("foo", std::bind(&CtrlAgentResponseCreatorTest:: fooCommandHandler, - this, _1, _2)); + this, ph::_1, ph::_2)); // Make sure that the request has been initialized properly. if (!request_) { diff --git a/src/bin/d2/d2_controller.cc b/src/bin/d2/d2_controller.cc index c77fe0fa96..ef3d9017d5 100644 --- a/src/bin/d2/d2_controller.cc +++ b/src/bin/d2/d2_controller.cc @@ -15,7 +15,7 @@ using namespace isc::config; using namespace isc::process; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace isc { namespace d2 { @@ -54,31 +54,31 @@ D2Controller::registerCommands() { // These are the commands always supported by the D2 server. // Please keep the list in alphabetic order. CommandMgr::instance().registerCommand(BUILD_REPORT_COMMAND, - std::bind(&D2Controller::buildReportHandler, this, _1, _2)); + std::bind(&D2Controller::buildReportHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand(CONFIG_GET_COMMAND, - std::bind(&D2Controller::configGetHandler, this, _1, _2)); + std::bind(&D2Controller::configGetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand(CONFIG_RELOAD_COMMAND, - std::bind(&D2Controller::configReloadHandler, this, _1, _2)); + std::bind(&D2Controller::configReloadHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand(CONFIG_SET_COMMAND, - std::bind(&D2Controller::configSetHandler, this, _1, _2)); + std::bind(&D2Controller::configSetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand(CONFIG_TEST_COMMAND, - std::bind(&D2Controller::configTestHandler, this, _1, _2)); + std::bind(&D2Controller::configTestHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand(CONFIG_WRITE_COMMAND, - std::bind(&D2Controller::configWriteHandler, this, _1, _2)); + std::bind(&D2Controller::configWriteHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand(SHUT_DOWN_COMMAND, - std::bind(&D2Controller::shutdownHandler, this, _1, _2)); + std::bind(&D2Controller::shutdownHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand(STATUS_GET_COMMAND, - std::bind(&DControllerBase::statusGetHandler, this, _1, _2)); + std::bind(&DControllerBase::statusGetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand(VERSION_GET_COMMAND, - std::bind(&D2Controller::versionGetHandler, this, _1, _2)); + std::bind(&D2Controller::versionGetHandler, this, ph::_1, ph::_2)); } void diff --git a/src/bin/d2/tests/d2_command_unittest.cc b/src/bin/d2/tests/d2_command_unittest.cc index 497cdfe569..8e47a41a6e 100644 --- a/src/bin/d2/tests/d2_command_unittest.cc +++ b/src/bin/d2/tests/d2_command_unittest.cc @@ -26,7 +26,6 @@ #include <unistd.h> using namespace std; -using namespace std::placeholders; using namespace isc; using namespace isc::asiolink; using namespace isc::config; @@ -35,6 +34,7 @@ using namespace isc::data; using namespace isc::dhcp::test; using namespace isc::process; using namespace boost::asio; +namespace ph = std::placeholders; namespace isc { namespace d2 { @@ -1161,7 +1161,7 @@ TEST_F(CtrlChannelD2Test, longCommand) { ASSERT_NO_THROW( CommandMgr::instance().registerCommand("foo", std::bind(&CtrlChannelD2Test::longCommandHandler, - command.str(), _1, _2)); + command.str(), ph::_1, ph::_2)); ); createUnixChannelServer(); @@ -1219,7 +1219,7 @@ TEST_F(CtrlChannelD2Test, longResponse) { // of a desired size ASSERT_NO_THROW( CommandMgr::instance().registerCommand("foo", - std::bind(&CtrlChannelD2Test::longResponseHandler, _1, _2)); + std::bind(&CtrlChannelD2Test::longResponseHandler, ph::_1, ph::_2)); ); createUnixChannelServer(); diff --git a/src/bin/d2/tests/dns_client_unittests.cc b/src/bin/d2/tests/dns_client_unittests.cc index dc339e0f22..7f1b34d5a7 100644 --- a/src/bin/d2/tests/dns_client_unittests.cc +++ b/src/bin/d2/tests/dns_client_unittests.cc @@ -19,7 +19,6 @@ #include <functional> using namespace std; -using namespace std::placeholders; using namespace isc; using namespace isc::asiolink; using namespace isc::asiodns; @@ -31,6 +30,8 @@ using namespace isc::util; using namespace boost::asio; using namespace boost::asio::ip; +namespace ph = std::placeholders; + namespace { const char* TEST_ADDRESS = "127.0.0.1"; @@ -373,7 +374,7 @@ public: sizeof(receive_buffer_)), remote, std::bind(&DNSClientTest::udpReceiveHandler, - this, &udp_socket, &remote, _2, + this, &udp_socket, &remote, ph::_2, corrupt_response)); // The socket is now ready to receive the data. Let's post some request @@ -434,7 +435,7 @@ public: remote, std::bind(&DNSClientTest:: TSIGReceiveHandler, this, - &udp_socket, &remote, _2, + &udp_socket, &remote, ph::_2, client_key, server_key)); // The socket is now ready to receive the data. Let's post some request diff --git a/src/bin/d2/tests/nc_test_utils.cc b/src/bin/d2/tests/nc_test_utils.cc index 5e0c92610f..ccc2482359 100644 --- a/src/bin/d2/tests/nc_test_utils.cc +++ b/src/bin/d2/tests/nc_test_utils.cc @@ -16,9 +16,9 @@ #include <gtest/gtest.h> using namespace std; -using namespace std::placeholders; using namespace isc; using namespace isc::d2; +namespace ph = std::placeholders; namespace isc { namespace d2 { @@ -98,7 +98,7 @@ FauxServer::receive (const ResponseMode& response_mode, sizeof(receive_buffer_)), remote_, std::bind(&FauxServer::requestHandler, - this, _1, _2, + this, ph::_1, ph::_2, response_mode, response_rcode)); } diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index e7bf23fb71..33efa9c503 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -37,7 +37,7 @@ using namespace isc::hooks; using namespace isc::stats; using namespace isc::util; using namespace std; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -798,7 +798,7 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) { // Re-open lease and host database with new parameters. try { DatabaseConnection::db_lost_callback = - std::bind(&ControlledDhcpv4Srv::dbLostCallback, srv, _1); + std::bind(&ControlledDhcpv4Srv::dbLostCallback, srv, ph::_1); CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess(); cfg_db->setAppendedParameters("universe=4"); cfg_db->createManagers(); @@ -974,80 +974,80 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t server_port /*= DHCP4_SERVER_P // These are the commands always supported by the DHCPv4 server. // Please keep the list in alphabetic order. CommandMgr::instance().registerCommand("build-report", - std::bind(&ControlledDhcpv4Srv::commandBuildReportHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandBuildReportHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-backend-pull", - std::bind(&ControlledDhcpv4Srv::commandConfigBackendPullHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandConfigBackendPullHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-get", - std::bind(&ControlledDhcpv4Srv::commandConfigGetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandConfigGetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-reload", - std::bind(&ControlledDhcpv4Srv::commandConfigReloadHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandConfigReloadHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-set", - std::bind(&ControlledDhcpv4Srv::commandConfigSetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandConfigSetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-test", - std::bind(&ControlledDhcpv4Srv::commandConfigTestHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandConfigTestHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-write", - std::bind(&ControlledDhcpv4Srv::commandConfigWriteHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandConfigWriteHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("dhcp-enable", - std::bind(&ControlledDhcpv4Srv::commandDhcpEnableHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandDhcpEnableHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("dhcp-disable", - std::bind(&ControlledDhcpv4Srv::commandDhcpDisableHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandDhcpDisableHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("libreload", - std::bind(&ControlledDhcpv4Srv::commandLibReloadHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandLibReloadHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("leases-reclaim", - std::bind(&ControlledDhcpv4Srv::commandLeasesReclaimHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandLeasesReclaimHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("server-tag-get", - std::bind(&ControlledDhcpv4Srv::commandServerTagGetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandServerTagGetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("shutdown", - std::bind(&ControlledDhcpv4Srv::commandShutdownHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandShutdownHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("status-get", - std::bind(&ControlledDhcpv4Srv::commandStatusGetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandStatusGetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("version-get", - std::bind(&ControlledDhcpv4Srv::commandVersionGetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandVersionGetHandler, this, ph::_1, ph::_2)); // Register statistic related commands CommandMgr::instance().registerCommand("statistic-get", - std::bind(&StatsMgr::statisticGetHandler, _1, _2)); + std::bind(&StatsMgr::statisticGetHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-reset", - std::bind(&StatsMgr::statisticResetHandler, _1, _2)); + std::bind(&StatsMgr::statisticResetHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-remove", - std::bind(&StatsMgr::statisticRemoveHandler, _1, _2)); + std::bind(&StatsMgr::statisticRemoveHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-get-all", - std::bind(&StatsMgr::statisticGetAllHandler, _1, _2)); + std::bind(&StatsMgr::statisticGetAllHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-reset-all", - std::bind(&StatsMgr::statisticResetAllHandler, _1, _2)); + std::bind(&StatsMgr::statisticResetAllHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-remove-all", - std::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2)); + std::bind(&StatsMgr::statisticRemoveAllHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-sample-age-set", - std::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, _1, _2)); + std::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-sample-age-set-all", - std::bind(&ControlledDhcpv4Srv::commandStatisticSetMaxSampleAgeAllHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandStatisticSetMaxSampleAgeAllHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-sample-count-set", - std::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2)); + std::bind(&StatsMgr::statisticSetMaxSampleCountHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-sample-count-set-all", - std::bind(&ControlledDhcpv4Srv::commandStatisticSetMaxSampleCountAllHandler, this, _1, _2)); + std::bind(&ControlledDhcpv4Srv::commandStatisticSetMaxSampleCountAllHandler, this, ph::_1, ph::_2)); } void ControlledDhcpv4Srv::shutdownServer(int exit_value) { diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 983802e726..744833e13c 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -82,7 +82,7 @@ using namespace isc::log; using namespace isc::stats; using namespace isc::util; using namespace std; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -3841,7 +3841,7 @@ Dhcpv4Srv::startD2() { // our error handler. // This may throw so wherever this is called needs to ready. d2_mgr.startSender(std::bind(&Dhcpv4Srv::d2ClientErrorHandler, - this, _1, _2)); + this, ph::_1, ph::_2)); } } diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index dbc432fab3..9ebb1ab23b 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -44,7 +44,6 @@ #include <unistd.h> using namespace std; -using namespace std::placeholders; using namespace isc; using namespace isc::asiolink; using namespace isc::config; @@ -55,6 +54,7 @@ using namespace isc::hooks; using namespace isc::stats; using namespace isc::test; using namespace isc::util; +namespace ph = std::placeholders; namespace { @@ -1530,7 +1530,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, longCommand) { ASSERT_NO_THROW( CommandMgr::instance().registerCommand("foo", std::bind(&CtrlChannelDhcpv4SrvTest::longCommandHandler, - command.str(), _1, _2)); + command.str(), ph::_1, ph::_2)); ); createUnixChannelServer(); @@ -1588,7 +1588,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, longResponse) { // of a desired size. ASSERT_NO_THROW( CommandMgr::instance().registerCommand("foo", - std::bind(&CtrlChannelDhcpv4SrvTest::longResponseHandler, _1, _2)); + std::bind(&CtrlChannelDhcpv4SrvTest::longResponseHandler, ph::_1, ph::_2)); ); createUnixChannelServer(); diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 4a83f8f742..dd4bc17880 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -37,7 +37,7 @@ using namespace isc::hooks; using namespace isc::stats; using namespace isc::util; using namespace std; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -801,7 +801,7 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) { // Re-open lease and host database with new parameters. try { DatabaseConnection::db_lost_callback = - std::bind(&ControlledDhcpv6Srv::dbLostCallback, srv, _1); + std::bind(&ControlledDhcpv6Srv::dbLostCallback, srv, ph::_1); CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess(); cfg_db->setAppendedParameters("universe=6"); cfg_db->createManagers(); @@ -993,80 +993,80 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port, // These are the commands always supported by the DHCPv6 server. // Please keep the list in alphabetic order. CommandMgr::instance().registerCommand("build-report", - std::bind(&ControlledDhcpv6Srv::commandBuildReportHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandBuildReportHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-backend-pull", - std::bind(&ControlledDhcpv6Srv::commandConfigBackendPullHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandConfigBackendPullHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-get", - std::bind(&ControlledDhcpv6Srv::commandConfigGetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandConfigGetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-reload", - std::bind(&ControlledDhcpv6Srv::commandConfigReloadHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandConfigReloadHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-test", - std::bind(&ControlledDhcpv6Srv::commandConfigTestHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandConfigTestHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-write", - std::bind(&ControlledDhcpv6Srv::commandConfigWriteHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandConfigWriteHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("dhcp-disable", - std::bind(&ControlledDhcpv6Srv::commandDhcpDisableHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandDhcpDisableHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("dhcp-enable", - std::bind(&ControlledDhcpv6Srv::commandDhcpEnableHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandDhcpEnableHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("leases-reclaim", - std::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("server-tag-get", - std::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("libreload", - std::bind(&ControlledDhcpv6Srv::commandLibReloadHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandLibReloadHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("config-set", - std::bind(&ControlledDhcpv6Srv::commandConfigSetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandConfigSetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("shutdown", - std::bind(&ControlledDhcpv6Srv::commandShutdownHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandShutdownHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("status-get", - std::bind(&ControlledDhcpv6Srv::commandStatusGetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandStatusGetHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("version-get", - std::bind(&ControlledDhcpv6Srv::commandVersionGetHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandVersionGetHandler, this, ph::_1, ph::_2)); // Register statistic related commands CommandMgr::instance().registerCommand("statistic-get", - std::bind(&StatsMgr::statisticGetHandler, _1, _2)); + std::bind(&StatsMgr::statisticGetHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-get-all", - std::bind(&StatsMgr::statisticGetAllHandler, _1, _2)); + std::bind(&StatsMgr::statisticGetAllHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-reset", - std::bind(&StatsMgr::statisticResetHandler, _1, _2)); + std::bind(&StatsMgr::statisticResetHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-reset-all", - std::bind(&StatsMgr::statisticResetAllHandler, _1, _2)); + std::bind(&StatsMgr::statisticResetAllHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-remove", - std::bind(&StatsMgr::statisticRemoveHandler, _1, _2)); + std::bind(&StatsMgr::statisticRemoveHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-remove-all", - std::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2)); + std::bind(&StatsMgr::statisticRemoveAllHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-sample-age-set", - std::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, _1, _2)); + std::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-sample-age-set-all", - std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-sample-count-set", - std::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2)); + std::bind(&StatsMgr::statisticSetMaxSampleCountHandler, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("statistic-sample-count-set-all", - std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler, this, _1, _2)); + std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler, this, ph::_1, ph::_2)); } void ControlledDhcpv6Srv::shutdownServer(int exit_value) { diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 9c44466c9c..5cc48e3722 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -91,7 +91,7 @@ using namespace isc::log; using namespace isc::stats; using namespace isc::util; using namespace std; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -3991,7 +3991,7 @@ Dhcpv6Srv::startD2() { // our error handler. // This may throw so wherever this is called needs to ready. d2_mgr.startSender(std::bind(&Dhcpv6Srv::d2ClientErrorHandler, - this, _1, _2)); + this, ph::_1, ph::_2)); } } diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index dd5a5b413a..c0ac48da0f 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -41,7 +41,6 @@ #include <unistd.h> using namespace std; -using namespace std::placeholders; using namespace isc; using namespace isc::asiolink; using namespace isc::config; @@ -52,6 +51,7 @@ using namespace isc::hooks; using namespace isc::stats; using namespace isc::test; using namespace isc::util; +namespace ph = std::placeholders; namespace { @@ -1558,7 +1558,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, longCommand) { ASSERT_NO_THROW( CommandMgr::instance().registerCommand("foo", std::bind(&CtrlChannelDhcpv6SrvTest::longCommandHandler, - command.str(), _1, _2)); + command.str(), ph::_1, ph::_2)); ); createUnixChannelServer(); @@ -1616,7 +1616,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, longResponse) { // of a desired size. ASSERT_NO_THROW( CommandMgr::instance().registerCommand("foo", - std::bind(&CtrlChannelDhcpv6SrvTest::longResponseHandler, _1, _2)); + std::bind(&CtrlChannelDhcpv6SrvTest::longResponseHandler, ph::_1, ph::_2)); ); createUnixChannelServer(); diff --git a/src/hooks/dhcp/high_availability/ha_service.cc b/src/hooks/dhcp/high_availability/ha_service.cc index 4f21e4a864..179518b727 100644 --- a/src/hooks/dhcp/high_availability/ha_service.cc +++ b/src/hooks/dhcp/high_availability/ha_service.cc @@ -35,7 +35,7 @@ using namespace isc::hooks; using namespace isc::http; using namespace isc::log; using namespace isc::util; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace isc { namespace ha { @@ -1093,8 +1093,8 @@ HAService::asyncSendLeaseUpdate(const QueryPtrType& query, } }, HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST), - std::bind(&HAService::clientConnectHandler, this, _1, _2), - std::bind(&HAService::clientCloseHandler, this, _1) + std::bind(&HAService::clientConnectHandler, this, ph::_1, ph::_2), + std::bind(&HAService::clientCloseHandler, this, ph::_1) ); // The number of pending requests is the number of requests for which we @@ -1373,8 +1373,8 @@ HAService::asyncSendHeartbeat() { runModel(HA_HEARTBEAT_COMPLETE_EVT); }, HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST), - std::bind(&HAService::clientConnectHandler, this, _1, _2), - std::bind(&HAService::clientCloseHandler, this, _1) + std::bind(&HAService::clientConnectHandler, this, ph::_1, ph::_2), + std::bind(&HAService::clientCloseHandler, this, ph::_1) ); } @@ -1464,8 +1464,8 @@ HAService::asyncDisableDHCPService(HttpClient& http_client, } }, HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST), - std::bind(&HAService::clientConnectHandler, this, _1, _2), - std::bind(&HAService::clientCloseHandler, this, _1) + std::bind(&HAService::clientConnectHandler, this, ph::_1, ph::_2), + std::bind(&HAService::clientCloseHandler, this, ph::_1) ); } @@ -1536,8 +1536,8 @@ HAService::asyncEnableDHCPService(HttpClient& http_client, } }, HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST), - std::bind(&HAService::clientConnectHandler, this, _1, _2), - std::bind(&HAService::clientCloseHandler, this, _1) + std::bind(&HAService::clientConnectHandler, this, ph::_1, ph::_2), + std::bind(&HAService::clientCloseHandler, this, ph::_1) ); } @@ -1777,8 +1777,8 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, } }, HttpClient::RequestTimeout(config_->getSyncTimeout()), - std::bind(&HAService::clientConnectHandler, this, _1, _2), - std::bind(&HAService::clientCloseHandler, this, _1) + std::bind(&HAService::clientConnectHandler, this, ph::_1, ph::_2), + std::bind(&HAService::clientCloseHandler, this, ph::_1) ); } @@ -2012,8 +2012,8 @@ HAService::processMaintenanceStart() { captured_error_message = error_message; }, HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST), - std::bind(&HAService::clientConnectHandler, this, _1, _2), - std::bind(&HAService::clientCloseHandler, this, _1) + std::bind(&HAService::clientConnectHandler, this, ph::_1, ph::_2), + std::bind(&HAService::clientCloseHandler, this, ph::_1) ); // Run the IO service until it is stopped by any of the callbacks. This @@ -2120,8 +2120,8 @@ HAService::processMaintenanceCancel() { } }, HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST), - std::bind(&HAService::clientConnectHandler, this, _1, _2), - std::bind(&HAService::clientCloseHandler, this, _1) + std::bind(&HAService::clientConnectHandler, this, ph::_1, ph::_2), + std::bind(&HAService::clientCloseHandler, this, ph::_1) ); // Run the IO service until it is stopped by any of the callbacks. This @@ -2204,7 +2204,7 @@ HAService::clientConnectHandler(const boost::system::error_code& ec, int tcp_nat // We are registerin the socket only to interrupt main-thread // select(). IfaceMgr::instance().addExternalSocket(tcp_native_fd, - std::bind(&HAService::socketReadyHandler, this, _1) + std::bind(&HAService::socketReadyHandler, this, ph::_1) ); } diff --git a/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc b/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc index c8142083cc..2cd36c87cc 100644 --- a/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc +++ b/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc @@ -24,7 +24,6 @@ #include <set> using namespace std; -using namespace std::placeholders; using namespace isc; using namespace isc::hooks; using namespace isc::config; @@ -34,6 +33,7 @@ using namespace isc::dhcp_ddns; using namespace isc::asiolink; using namespace isc::stats; using namespace isc::test; +namespace ph = std::placeholders; namespace { @@ -659,7 +659,7 @@ public: ASSERT_NO_THROW(cfg->enableUpdates(true)); ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(cfg)); d2_mgr_.startSender(std::bind(&LeaseCmdsTest::d2ErrorHandler, this, - _1, _2)); + ph::_1, ph::_2)); } /// @brief Disables DHCP-DDNS updates. diff --git a/src/lib/asiolink/unix_domain_socket.cc b/src/lib/asiolink/unix_domain_socket.cc index f59e68a553..ca9e15ce30 100644 --- a/src/lib/asiolink/unix_domain_socket.cc +++ b/src/lib/asiolink/unix_domain_socket.cc @@ -11,8 +11,9 @@ #include <boost/enable_shared_from_this.hpp> #include <functional> #include <iostream> + using namespace boost::asio::local; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace isc { namespace asiolink { @@ -167,7 +168,7 @@ UnixDomainSocketImpl::asyncConnect(const stream_protocol::endpoint& endpoint, const UnixDomainSocket::ConnectHandler& handler) { auto local_handler = std::bind(&UnixDomainSocketImpl::connectHandler, shared_from_this(), - handler, _1); + handler, ph::_1); socket_.async_connect(endpoint, local_handler); } @@ -197,7 +198,7 @@ UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer, const UnixDomainSocket::Handler& handler) { auto local_handler = std::bind(&UnixDomainSocketImpl::sendHandler, shared_from_this(), - handler, buffer, _1, _2); + handler, buffer, ph::_1, ph::_2); socket_.async_send(buffer, local_handler); } @@ -230,7 +231,7 @@ UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer, const UnixDomainSocket::Handler& handler) { auto local_handler = std::bind(&UnixDomainSocketImpl::receiveHandler, shared_from_this(), - handler, buffer, _1, _2); + handler, buffer, ph::_1, ph::_2); socket_.async_receive(buffer, 0, local_handler); } diff --git a/src/lib/database/tests/database_connection_unittest.cc b/src/lib/database/tests/database_connection_unittest.cc index 2d5db619d8..7d27b7c75b 100644 --- a/src/lib/database/tests/database_connection_unittest.cc +++ b/src/lib/database/tests/database_connection_unittest.cc @@ -16,6 +16,7 @@ using namespace isc::data; using namespace isc::db; +namespace ph = std::placeholders; /// @brief Test fixture for exercising DbLostCallback invocation class DatabaseConnectionCallbackTest : public ::testing::Test { @@ -84,7 +85,6 @@ TEST_F(DatabaseConnectionCallbackTest, NoDbLostCallback) { TEST_F(DatabaseConnectionCallbackTest, dbLostCallback) { /// Create a Database configuration that includes the reconnect /// control parameters. - using namespace std::placeholders; DatabaseConnection::ParameterMap pmap; pmap[std::string("type")] = std::string("test"); pmap[std::string("max-reconnect-tries")] = std::string("3"); @@ -92,7 +92,7 @@ TEST_F(DatabaseConnectionCallbackTest, dbLostCallback) { /// Install the callback. DatabaseConnection::db_lost_callback = - std::bind(&DatabaseConnectionCallbackTest::dbLostCallback, this, _1); + std::bind(&DatabaseConnectionCallbackTest::dbLostCallback, this, ph::_1); /// Create the connection.. DatabaseConnection datasrc(pmap); diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc index dcd6bcbae2..8aa901517c 100644 --- a/src/lib/dhcp/tests/iface_mgr_unittest.cc +++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc @@ -31,12 +31,12 @@ #include <unistd.h> using namespace std; -using namespace std::placeholders; using namespace isc; using namespace isc::asiolink; using namespace isc::dhcp; using namespace isc::dhcp::test; using boost::scoped_ptr; +namespace ph = std::placeholders; namespace { @@ -1854,7 +1854,7 @@ TEST_F(IfaceMgrTest, openSockets4IfaceDown) { // should be called when the IfaceMgr fails to open socket on an interface // on which the server is configured to listen. isc::dhcp::IfaceMgrErrorMsgCallback error_handler = - std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1); + std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, ph::_1); ASSERT_NO_THROW(IfaceMgr::instance().openSockets4(DHCP4_SERVER_PORT, true, error_handler)); @@ -1957,7 +1957,7 @@ TEST_F(IfaceMgrTest, openSocket4ErrorHandler) { // Install an error handler before trying to open sockets. This handler // should be called when the IfaceMgr fails to open socket on eth0. isc::dhcp::IfaceMgrErrorMsgCallback error_handler = - std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1); + std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, ph::_1); // The openSockets4 should detect that there is another socket already // open and bound to the same address and port. An attempt to open // another socket and bind to this address and port should fail. @@ -2297,7 +2297,7 @@ TEST_F(IfaceMgrTest, openSockets6IfaceDown) { // Install an error handler before trying to open sockets. This handler // should be called when the IfaceMgr fails to open socket on eth0. isc::dhcp::IfaceMgrErrorMsgCallback error_handler = - std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1); + std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, ph::_1); // Simulate opening sockets using the dummy packet filter. bool success = false; @@ -2424,7 +2424,7 @@ TEST_F(IfaceMgrTest, openSocket6ErrorHandler) { // Install an error handler before trying to open sockets. This handler // should be called when the IfaceMgr fails to open socket on eth0. isc::dhcp::IfaceMgrErrorMsgCallback error_handler = - std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1); + std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, ph::_1); // The openSockets6 should detect that a socket has been already // opened on eth0 and an attempt to open another socket and bind to // the same address and port should fail. diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc index b0ee2ac5e8..fb33e8e5e6 100644 --- a/src/lib/dhcp_ddns/ncr_udp.cc +++ b/src/lib/dhcp_ddns/ncr_udp.cc @@ -11,6 +11,8 @@ #include <functional> +namespace ph = std::placeholders; + namespace isc { namespace dhcp_ddns { @@ -70,13 +72,12 @@ NameChangeUDPListener(const isc::asiolink::IOAddress& ip_address, // Instantiate the receive callback. This gets passed into each receive. // Note that the callback constructor is passed an instance method // pointer to our completion handler method, receiveCompletionHandler. - using namespace std::placeholders; RawBufferPtr buffer(new uint8_t[RECV_BUF_MAX]); UDPEndpointPtr data_source(new asiolink::UDPEndpoint()); recv_callback_.reset(new UDPCallback(buffer, RECV_BUF_MAX, data_source, std::bind(&NameChangeUDPListener:: - receiveCompletionHandler, this, _1, _2))); + receiveCompletionHandler, this, ph::_1, ph::_2))); } NameChangeUDPListener::~NameChangeUDPListener() { @@ -206,13 +207,12 @@ NameChangeUDPSender(const isc::asiolink::IOAddress& ip_address, // Instantiate the send callback. This gets passed into each send. // Note that the callback constructor is passed the an instance method // pointer to our completion handler, sendCompletionHandler. - using namespace std::placeholders; RawBufferPtr buffer(new uint8_t[SEND_BUF_MAX]); UDPEndpointPtr data_source(new asiolink::UDPEndpoint()); send_callback_.reset(new UDPCallback(buffer, SEND_BUF_MAX, data_source, std::bind(&NameChangeUDPSender:: sendCompletionHandler, this, - _1, _2))); + ph::_1, ph::_2))); } NameChangeUDPSender::~NameChangeUDPSender() { diff --git a/src/lib/dhcpsrv/cfg_iface.cc b/src/lib/dhcpsrv/cfg_iface.cc index 68a2f0e868..46d580a8d5 100644 --- a/src/lib/dhcpsrv/cfg_iface.cc +++ b/src/lib/dhcpsrv/cfg_iface.cc @@ -14,7 +14,7 @@ using namespace isc::asiolink; using namespace isc::data; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace isc { namespace dhcp { @@ -152,7 +152,7 @@ CfgIface::openSockets(const uint16_t family, const uint16_t port, // for some specific interface. This callback will simply log a // warning message. IfaceMgrErrorMsgCallback error_callback = - std::bind(&CfgIface::socketOpenErrorHandler, _1); + std::bind(&CfgIface::socketOpenErrorHandler, ph::_1); bool sopen; if (family == AF_INET) { // Use broadcast only if we're using raw sockets. For the UDP sockets, diff --git a/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc index c3b4828afc..be89802b7a 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc @@ -22,7 +22,6 @@ #include <vector> using namespace std; -using namespace std::placeholders; using namespace isc; using namespace isc::asiolink; using namespace isc::dhcp; @@ -30,6 +29,7 @@ using namespace isc::dhcp::test; using namespace isc::dhcp_ddns; using namespace isc::hooks; using namespace isc::stats; +namespace ph = std::placeholders; namespace { @@ -232,7 +232,7 @@ public: D2ClientConfigPtr cfg(new D2ClientConfig()); cfg->enableUpdates(true); mgr.setD2ClientConfig(cfg); - mgr.startSender(std::bind(&ExpirationAllocEngineTest::d2ErrorHandler, _1, _2)); + mgr.startSender(std::bind(&ExpirationAllocEngineTest::d2ErrorHandler, ph::_1, ph::_2)); } /// @brief No-op error handler for the D2 client. diff --git a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc index 47b96f5797..66471b9b3e 100644 --- a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc @@ -21,9 +21,9 @@ #include <sys/select.h> using namespace std; -using namespace std::placeholders; using namespace isc::dhcp; using namespace isc; +namespace ph = std::placeholders; namespace { @@ -165,7 +165,7 @@ public: /// @brief Returns D2ClientErroHandler bound to this::error_handler_. D2ClientErrorHandler getErrorHandler() { - return (std::bind(&D2ClientMgrTest::error_handler, this, _1, _2)); + return (std::bind(&D2ClientMgrTest::error_handler, this, ph::_1, ph::_2)); } /// @brief Constructs a NameChangeRequest message from a fixed JSON string. diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc index fc2db6f4c1..275492e131 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc @@ -26,10 +26,10 @@ #include <sstream> using namespace std; -using namespace std::placeholders; using namespace isc::asiolink; using namespace isc::data; using namespace isc::db; +namespace ph = std::placeholders; namespace isc { namespace dhcp { @@ -3285,7 +3285,7 @@ LeaseMgrDbLostCallbackTest::TearDown() { void LeaseMgrDbLostCallbackTest::testNoCallbackOnOpenFailure() { DatabaseConnection::db_lost_callback = - std::bind(&LeaseMgrDbLostCallbackTest::db_lost_callback, this, _1); + std::bind(&LeaseMgrDbLostCallbackTest::db_lost_callback, this, ph::_1); callback_called_ = false; ASSERT_THROW(LeaseMgrFactory::create(invalidConnectString()), @@ -3298,7 +3298,7 @@ void LeaseMgrDbLostCallbackTest::testDbLostCallback() { // Set the connectivity lost callback. DatabaseConnection::db_lost_callback = - std::bind(&LeaseMgrDbLostCallbackTest::db_lost_callback, this, _1); + std::bind(&LeaseMgrDbLostCallbackTest::db_lost_callback, this, ph::_1); // Connect to the lease backend. ASSERT_NO_THROW(LeaseMgrFactory::create(validConnectString())); diff --git a/src/lib/dhcpsrv/tests/host_mgr_unittest.cc b/src/lib/dhcpsrv/tests/host_mgr_unittest.cc index bcb67ac144..a6a2174d52 100644 --- a/src/lib/dhcpsrv/tests/host_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_mgr_unittest.cc @@ -33,7 +33,7 @@ using namespace isc::db; using namespace isc::dhcp; using namespace isc::dhcp::test; using namespace isc::asiolink; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -1132,7 +1132,7 @@ HostMgrDbLostCallbackTest::testDbLostCallback() { // Set the connectivity lost callback. DatabaseConnection::db_lost_callback = - std::bind(&HostMgrDbLostCallbackTest::db_lost_callback, this, _1); + std::bind(&HostMgrDbLostCallbackTest::db_lost_callback, this, ph::_1); // Find the most recently opened socket. Our SQL client's socket should // be the next one. diff --git a/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc b/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc index 06f956e6e0..2bbb6b2315 100644 --- a/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc +++ b/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc @@ -23,7 +23,7 @@ using namespace isc; using namespace isc::asiolink; using namespace isc::dhcp; using namespace isc::dhcp_ddns; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -82,7 +82,7 @@ public: ASSERT_NO_THROW(cfg->enableUpdates(true)); ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(cfg)); d2_mgr_.startSender(std::bind(&NCRGeneratorTest::d2ErrorHandler, this, - _1, _2)); + ph::_1, ph::_2)); } /// @brief Disables DHCP-DDNS updates. diff --git a/src/lib/dns/rrcollator.cc b/src/lib/dns/rrcollator.cc index 8d90b23bc6..d204e3e421 100644 --- a/src/lib/dns/rrcollator.cc +++ b/src/lib/dns/rrcollator.cc @@ -87,9 +87,9 @@ RRCollator::~RRCollator() { AddRRCallback RRCollator::getCallback() { - using namespace std::placeholders; + namespace ph = std::placeholders; return (std::bind(&RRCollator::Impl::addRR, this->impl_, - _1, _2, _3, _4, _5)); + ph::_1, ph::_2, ph::_3, ph::_4, ph::_5)); } void diff --git a/src/lib/dns/rrset_collection.cc b/src/lib/dns/rrset_collection.cc index 6760e07b22..a98ed16ae7 100644 --- a/src/lib/dns/rrset_collection.cc +++ b/src/lib/dns/rrset_collection.cc @@ -16,6 +16,7 @@ #include <functional> using namespace isc; +namespace ph = std::placeholders; namespace isc { namespace dns { @@ -45,11 +46,10 @@ void RRsetCollection::constructHelper(T source, const isc::dns::Name& origin, const isc::dns::RRClass& rrclass) { - using namespace std::placeholders; - RRCollator collator(std::bind(&RRsetCollection::addRRset, this, _1)); + RRCollator collator(std::bind(&RRsetCollection::addRRset, this, ph::_1)); MasterLoaderCallbacks callbacks - (std::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3), - std::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3)); + (std::bind(&RRsetCollection::loaderCallback, this, ph::_1, ph::_2, ph::_3), + std::bind(&RRsetCollection::loaderCallback, this, ph::_1, ph::_2, ph::_3)); MasterLoader loader(source, origin, rrclass, callbacks, collator.getCallback(), MasterLoader::DEFAULT); diff --git a/src/lib/dns/tests/master_loader_callbacks_test.cc b/src/lib/dns/tests/master_loader_callbacks_test.cc index 977e19b725..9d238023dd 100644 --- a/src/lib/dns/tests/master_loader_callbacks_test.cc +++ b/src/lib/dns/tests/master_loader_callbacks_test.cc @@ -21,7 +21,7 @@ namespace { using std::string; using namespace isc::dns; - using namespace std::placeholders; +namespace ph = std::placeholders; class MasterLoaderCallbacksTest : public ::testing::Test { protected: @@ -31,9 +31,9 @@ protected: rrset_(new RRset(Name("example.org"), RRClass::IN(), RRType::A(), RRTTL(3600))), error_(std::bind(&MasterLoaderCallbacksTest::checkCallback, this, - true, _1, _2, _3)), + true, ph::_1, ph::_2, ph::_3)), warning_(std::bind(&MasterLoaderCallbacksTest::checkCallback, this, - false, _1, _2, _3)), + false, ph::_1, ph::_2, ph::_3)), callbacks_(error_, warning_) {} diff --git a/src/lib/dns/tests/master_loader_unittest.cc b/src/lib/dns/tests/master_loader_unittest.cc index 57f6e0ca83..544e48e131 100644 --- a/src/lib/dns/tests/master_loader_unittest.cc +++ b/src/lib/dns/tests/master_loader_unittest.cc @@ -27,22 +27,22 @@ #include <sstream> using namespace isc::dns; -using namespace std::placeholders; using std::vector; using std::string; using std::list; using std::stringstream; using std::endl; using boost::lexical_cast; +namespace ph = std::placeholders; namespace { class MasterLoaderTest : public ::testing::Test { public: MasterLoaderTest() : callbacks_(std::bind(&MasterLoaderTest::callback, this, - &errors_, _1, _2, _3), + &errors_, ph::_1, ph::_2, ph::_3), std::bind(&MasterLoaderTest::callback, this, - &warnings_, _1, _2, _3)) + &warnings_, ph::_1, ph::_2, ph::_3)) {} void TearDown() { @@ -73,7 +73,8 @@ public: { loader_.reset(new MasterLoader(file, origin, rrclass, callbacks_, std::bind(&MasterLoaderTest::addRRset, - this, _1, _2, _3, _4, _5), + this, ph::_1, ph::_2, ph::_3, + ph::_4, ph::_5), options)); } @@ -82,7 +83,8 @@ public: { loader_.reset(new MasterLoader(stream, origin, rrclass, callbacks_, std::bind(&MasterLoaderTest::addRRset, - this, _1, _2, _3, _4, _5), + this, ph::_1, ph::_2, ph::_3, + ph::_4, ph::_5), options)); } diff --git a/src/lib/dns/tests/masterload_unittest.cc b/src/lib/dns/tests/masterload_unittest.cc index 52fc989e61..f5fd00fa33 100644 --- a/src/lib/dns/tests/masterload_unittest.cc +++ b/src/lib/dns/tests/masterload_unittest.cc @@ -22,8 +22,8 @@ #include <dns/rrset.h> using namespace std; -using namespace std::placeholders; using namespace isc::dns; +namespace ph = std::placeholders; namespace { // A callback functor for masterLoad() commonly used for the following tests. @@ -94,7 +94,7 @@ TEST_F(MasterLoadTest, loadWithFunctionCallback) { // object) rr_stream << txt_rr << a_rr1 << soa_rr; masterLoad(rr_stream, origin, zclass, - std::bind(&testCallback, _1, &results)); + std::bind(&testCallback, ph::_1, &results)); ASSERT_EQ(3, results.size()); EXPECT_EQ(txt_rr, results[0]->toText()); EXPECT_EQ(a_rr1, results[1]->toText()); @@ -106,7 +106,7 @@ TEST_F(MasterLoadTest, loadWithMemFunctionCallback) { // help of std.bind) rr_stream << txt_rr << a_rr1 << soa_rr; masterLoad(rr_stream, origin, zclass, - std::bind(&MasterLoadTest::rrsetCallback, this, _1)); + std::bind(&MasterLoadTest::rrsetCallback, this, ph::_1)); ASSERT_EQ(3, results.size()); EXPECT_EQ(txt_rr, results[0]->toText()); EXPECT_EQ(a_rr1, results[1]->toText()); diff --git a/src/lib/dns/tests/rdata_unittest.cc b/src/lib/dns/tests/rdata_unittest.cc index e774ddea81..e189d0f717 100644 --- a/src/lib/dns/tests/rdata_unittest.cc +++ b/src/lib/dns/tests/rdata_unittest.cc @@ -28,12 +28,12 @@ #include <boost/lexical_cast.hpp> using namespace std; -using namespace std::placeholders; using namespace isc::dns; using namespace isc::util; using namespace isc::dns::rdata; using isc::UnitTestUtil; using isc::util::unittests::matchWireData; +namespace ph = std::placeholders; namespace isc { namespace dns { @@ -137,9 +137,9 @@ TEST_F(RdataTest, createRdataWithLexer) { CreateRdataCallback callback; MasterLoaderCallbacks callbacks( std::bind(&CreateRdataCallback::callback, &callback, - CreateRdataCallback::ERROR, _1, _2, _3), + CreateRdataCallback::ERROR, ph::_1, ph::_2, ph::_3), std::bind(&CreateRdataCallback::callback, &callback, - CreateRdataCallback::WARN, _1, _2, _3)); + CreateRdataCallback::WARN, ph::_1, ph::_2, ph::_3)); size_t line = 0; diff --git a/src/lib/dns/tests/rrcollator_unittest.cc b/src/lib/dns/tests/rrcollator_unittest.cc index bb3618f4d5..4247911d35 100644 --- a/src/lib/dns/tests/rrcollator_unittest.cc +++ b/src/lib/dns/tests/rrcollator_unittest.cc @@ -26,7 +26,7 @@ using std::vector; using namespace isc::dns; using namespace isc::dns::rdata; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -46,7 +46,7 @@ protected: RRCollatorTest() : origin_("example.com"), rrclass_(RRClass::IN()), rrttl_(3600), throw_from_callback_(false), - collator_(std::bind(addRRset, _1, &rrsets_, &throw_from_callback_)), + collator_(std::bind(addRRset, ph::_1, &rrsets_, &throw_from_callback_)), rr_callback_(collator_.getCallback()), a_rdata1_(createRdata(RRType::A(), rrclass_, "192.0.2.1")), a_rdata2_(createRdata(RRType::A(), rrclass_, "192.0.2.2")), diff --git a/src/lib/dns/tests/zone_checker_unittest.cc b/src/lib/dns/tests/zone_checker_unittest.cc index d2f5a41344..863b439eb4 100644 --- a/src/lib/dns/tests/zone_checker_unittest.cc +++ b/src/lib/dns/tests/zone_checker_unittest.cc @@ -31,7 +31,7 @@ using isc::Unexpected; using namespace isc::dns; using namespace isc::dns::rdata; -using namespace std::placeholders; +namespace ph = std::placeholders; namespace { @@ -47,8 +47,8 @@ protected: zname_("example.com"), zclass_(RRClass::IN()), soa_(new RRset(zname_, zclass_, RRType::SOA(), RRTTL(60))), ns_(new RRset(zname_, zclass_, RRType::NS(), RRTTL(60))), - callbacks_(std::bind(&ZoneCheckerTest::callback, this, _1, true), - std::bind(&ZoneCheckerTest::callback, this, _1, false)) + callbacks_(std::bind(&ZoneCheckerTest::callback, this, ph::_1, true), + std::bind(&ZoneCheckerTest::callback, this, ph::_1, false)) { std::stringstream ss; ss << "example.com. 60 IN SOA " << soa_txt << "\n"; @@ -133,7 +133,7 @@ TEST_F(ZoneCheckerTest, checkSOA) { // If null callback is specified, checkZone() only returns the final // result. ZoneCheckerCallbacks noerror_callbacks( - 0, std::bind(&ZoneCheckerTest::callback, this, _1, false)); + 0, std::bind(&ZoneCheckerTest::callback, this, ph::_1, false)); EXPECT_FALSE(checkZone(zname_, zclass_, *rrsets_, noerror_callbacks)); checkIssues(); @@ -197,7 +197,7 @@ TEST_F(ZoneCheckerTest, checkNSData) { // Same check, but disabling warning callback. Same result, but without // the warning. ZoneCheckerCallbacks nowarn_callbacks( - std::bind(&ZoneCheckerTest::callback, this, _1, true), 0); + std::bind(&ZoneCheckerTest::callback, this, ph::_1, true), 0); EXPECT_TRUE(checkZone(zname_, zclass_, *rrsets_, nowarn_callbacks)); checkIssues(); diff --git a/src/lib/dns/zone_checker.cc b/src/lib/dns/zone_checker.cc index 7fe81726a8..3769fedec6 100644 --- a/src/lib/dns/zone_checker.cc +++ b/src/lib/dns/zone_checker.cc @@ -175,10 +175,9 @@ bool checkZone(const Name& zone_name, const RRClass& zone_class, const RRsetCollectionBase& zone_rrsets, const ZoneCheckerCallbacks& callbacks) { - using namespace std::placeholders; bool had_error = false; ZoneCheckerCallbacks my_callbacks( - std::bind(errorWrapper, _1, &callbacks, &had_error), + std::bind(errorWrapper, std::placeholders::_1, &callbacks, &had_error), std::bind(&ZoneCheckerCallbacks::warn, &callbacks, _1)); checkSOA(zone_name, zone_class, zone_rrsets, my_callbacks); diff --git a/src/lib/process/daemon.cc b/src/lib/process/daemon.cc index 0466706d2b..aa42e21fb8 100644 --- a/src/lib/process/daemon.cc +++ b/src/lib/process/daemon.cc @@ -61,9 +61,8 @@ void Daemon::shutdown() { } void Daemon::handleSignal() { - using namespace std::placeholders; if (signal_set_ && signal_handler_) { - signal_set_->handleNext(std::bind(signal_handler_, _1)); + signal_set_->handleNext(std::bind(signal_handler_, std::placeholders::_1)); } } @@ -251,5 +250,5 @@ Daemon::writeConfigFile(const std::string& config_file, return (bytes); } -}; -}; +} +} diff --git a/src/lib/process/io_service_signal.cc b/src/lib/process/io_service_signal.cc index 6c14e9de56..448fd1171f 100644 --- a/src/lib/process/io_service_signal.cc +++ b/src/lib/process/io_service_signal.cc @@ -82,9 +82,10 @@ IOSignalSetImpl::callback(const boost::system::error_code& ec, int signum) { void IOSignalSetImpl::install() { - using namespace std::placeholders; signal_set_.async_wait(std::bind(&IOSignalSetImpl::callback, - shared_from_this(), _1, _2)); + shared_from_this(), + std::placeholders::_1, + std::placeholders::_2)); } void @@ -113,5 +114,5 @@ IOSignalSet::add(int signum) { impl_->add(signum); } -}; // end of isc::process namespace -}; // end of isc namespace +} // end of isc::process namespace +} // end of isc namespace diff --git a/src/lib/util/tests/signal_set_unittest.cc b/src/lib/util/tests/signal_set_unittest.cc index 5e02e7e185..90c25f583d 100644 --- a/src/lib/util/tests/signal_set_unittest.cc +++ b/src/lib/util/tests/signal_set_unittest.cc @@ -15,7 +15,7 @@ namespace { using namespace isc; using namespace isc::util; -using namespace std::placeholders; +namespace ph = std::placeholders; /// @brief Test fixture class for @c isc::util::SignalSet class. /// @@ -109,14 +109,14 @@ TEST_F(SignalSetTest, twoSignals) { // second one should be dropped. ASSERT_EQ(0, raise(SIGHUP)); // Execute the first handler (for SIGHUP). - signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1)); + signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, ph::_1)); // The handler should have been called once and the signal // handled should be SIGHUP. EXPECT_EQ(1, handler_calls_); EXPECT_EQ(SIGHUP, signum_); // Next signal to be handled should be SIGINT. EXPECT_EQ(SIGINT, signal_set_->getNext()); - signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1)); + signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, ph::_1)); EXPECT_EQ(2, handler_calls_); EXPECT_EQ(SIGINT, signum_); // There should be no more waiting handlers. @@ -143,13 +143,13 @@ TEST_F(SignalSetTest, twoSignalSets) { // The signal set owns SIGHUP so it should be the next to handle. EXPECT_EQ(SIGHUP, signal_set_->getNext()); // Handle next signal owned by the secondary signal set. - secondary_signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1)); + secondary_signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, ph::_1)); EXPECT_EQ(1, handler_calls_); EXPECT_EQ(SIGINT, signum_); // No more signals to be handled for this signal set. EXPECT_EQ(-1, secondary_signal_set_->getNext()); // Handle next signal owned by the signal set. - signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1)); + signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, ph::_1)); EXPECT_EQ(2, handler_calls_); EXPECT_EQ(SIGHUP, signum_); // No more signals to be handled by this signal set. @@ -200,7 +200,7 @@ TEST_F(SignalSetTest, duplicates) { TEST_F(SignalSetTest, onReceiptTests) { // Install an on-receipt handler. SignalSet::setOnReceiptHandler(std::bind(&SignalSetTest::onReceiptHandler, - this, _1)); + this, ph::_1)); // Create a SignalSet for SIGHUP and SIGUSR1. ASSERT_NO_THROW(signal_set_.reset(new SignalSet(SIGHUP, SIGUSR1))); @@ -219,7 +219,7 @@ TEST_F(SignalSetTest, onReceiptTests) { EXPECT_EQ(SIGUSR1, signal_set_->getNext()); // Verify we can process SIGUSR1 with the deferred handler. - signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1)); + signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, ph::_1)); EXPECT_EQ(1, handler_calls_); EXPECT_EQ(SIGUSR1, signum_); @@ -234,7 +234,7 @@ TEST_F(SignalSetTest, onReceiptTests) { EXPECT_EQ(SIGHUP, signal_set_->getNext()); // Verify we can process it with deferred handler. - signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1)); + signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, ph::_1)); EXPECT_EQ(2, handler_calls_); EXPECT_EQ(SIGHUP, signum_); } |