From: Razvan Becheriu Date: Thu, 13 Aug 2020 11:54:05 +0000 (+0300) Subject: [#1308] cleanup X-Git-Tag: Kea-1.8.0~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a9ac06460e9d4a797284990889dda304aecea5d;p=thirdparty%2Fkea.git [#1308] cleanup --- diff --git a/src/bin/d2/tests/dns_client_unittests.cc b/src/bin/d2/tests/dns_client_unittests.cc index 7f1b34d5a7..02bbc569c8 100644 --- a/src/bin/d2/tests/dns_client_unittests.cc +++ b/src/bin/d2/tests/dns_client_unittests.cc @@ -29,7 +29,6 @@ using namespace isc::dns; using namespace isc::util; using namespace boost::asio; using namespace boost::asio::ip; - namespace ph = std::placeholders; namespace { diff --git a/src/lib/asiolink/interval_timer.cc b/src/lib/asiolink/interval_timer.cc index b74901969e..2cda9b0085 100644 --- a/src/lib/asiolink/interval_timer.cc +++ b/src/lib/asiolink/interval_timer.cc @@ -20,6 +20,7 @@ #include using namespace std; +namespace ph = std::placeholders; namespace isc { namespace asiolink { @@ -142,7 +143,7 @@ IntervalTimerImpl::update() { // Pass a function bound with a shared_ptr to this. timer_.async_wait(std::bind(&IntervalTimerImpl::callback, shared_from_this(), - std::placeholders::_1)); //error + ph::_1)); //error } catch (const boost::system::system_error& e) { isc_throw(isc::Unexpected, "Failed to update timer: " << e.what()); } catch (const boost::bad_weak_ptr&) { diff --git a/src/lib/asiolink/tests/tcp_acceptor_unittest.cc b/src/lib/asiolink/tests/tcp_acceptor_unittest.cc index 8229bbcdb7..d674146fd3 100644 --- a/src/lib/asiolink/tests/tcp_acceptor_unittest.cc +++ b/src/lib/asiolink/tests/tcp_acceptor_unittest.cc @@ -20,6 +20,7 @@ #include using namespace isc::asiolink; +namespace ph = std::placeholders; namespace { @@ -83,7 +84,7 @@ public: SERVER_PORT); socket_.async_connect(endpoint, std::bind(&TCPClient::connectHandler, this, - std::placeholders::_1)); + ph::_1)); } /// @brief Callback function for connect(). @@ -251,7 +252,7 @@ public: /// retained in the connections_ list. void accept() { TCPAcceptorCallback cb = std::bind(&TCPAcceptorTest::acceptHandler, - this, std::placeholders::_1); + this, ph::_1); AcceptorPtr conn(new Acceptor(io_service_, acceptor_, cb)); connections_.push_back(conn); connections_.back()->accept(); diff --git a/src/lib/asiolink/testutils/test_server_unix_socket.cc b/src/lib/asiolink/testutils/test_server_unix_socket.cc index d22b9802a1..7f7007d018 100644 --- a/src/lib/asiolink/testutils/test_server_unix_socket.cc +++ b/src/lib/asiolink/testutils/test_server_unix_socket.cc @@ -15,6 +15,7 @@ #include using namespace boost::asio::local; +namespace ph = std::placeholders; namespace isc { namespace asiolink { @@ -55,8 +56,8 @@ public: void start() { socket_->async_read_some(boost::asio::buffer(&raw_buf_[0], raw_buf_.size()), std::bind(&Connection::readHandler, shared_from_this(), - std::placeholders::_1, // error - std::placeholders::_2)); // bytes_transferred + ph::_1, // error + ph::_2)); // bytes_transferred } /// @brief Closes the socket. @@ -293,7 +294,7 @@ void TestServerUnixSocket::accept() { server_acceptor_.async_accept(*(connection_pool_->getSocket()), std::bind(&TestServerUnixSocket::acceptHandler, this, - std::placeholders::_1)); // error + ph::_1)); // error } void diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc index 1fcbdd7713..8293fd77e0 100644 --- a/src/lib/dhcp_ddns/ncr_udp.cc +++ b/src/lib/dhcp_ddns/ncr_udp.cc @@ -76,7 +76,7 @@ NameChangeUDPListener(const isc::asiolink::IOAddress& ip_address, UDPEndpointPtr data_source(new asiolink::UDPEndpoint()); recv_callback_.reset(new UDPCallback(buffer, RECV_BUF_MAX, data_source, std::bind(&NameChangeUDPListener::receiveCompletionHandler, - this, ph::_1, ph::_2))); + this, ph::_1, ph::_2))); } NameChangeUDPListener::~NameChangeUDPListener() { diff --git a/src/lib/dhcpsrv/parsers/client_class_def_parser.cc b/src/lib/dhcpsrv/parsers/client_class_def_parser.cc index 4be5e85dcf..91fb089322 100644 --- a/src/lib/dhcpsrv/parsers/client_class_def_parser.cc +++ b/src/lib/dhcpsrv/parsers/client_class_def_parser.cc @@ -86,7 +86,6 @@ ClientClassDefParser::parse(ClientClassDictionaryPtr& class_dictionary, bool depend_on_known = false; if (test_cfg) { ExpressionParser parser; - using std::placeholders::_1; auto check_defined = [&class_dictionary, &depend_on_known] (const ClientClass& cclass) { diff --git a/src/lib/dns/masterload.cc b/src/lib/dns/masterload.cc index ef32ea2dae..94638c17ae 100644 --- a/src/lib/dns/masterload.cc +++ b/src/lib/dns/masterload.cc @@ -28,9 +28,11 @@ #include #include -using namespace std; using namespace isc::dns::rdata; +using namespace std; +namespace ph = std::placeholders; + namespace isc { namespace dns { namespace { @@ -62,8 +64,8 @@ void loadHelper(InputType input, const Name& origin, const RRClass& zone_class, MasterLoadCallback callback) { - RRCollator rr_collator(std::bind(callbackWrapper, std::placeholders::_1, - callback, &origin)); + RRCollator rr_collator(std::bind(callbackWrapper, ph::_1, callback, + &origin)); MasterLoader loader(input, origin, zone_class, MasterLoaderCallbacks::getNullCallbacks(), rr_collator.getCallback()); diff --git a/src/lib/dns/rrcollator.cc b/src/lib/dns/rrcollator.cc index d204e3e421..8378021675 100644 --- a/src/lib/dns/rrcollator.cc +++ b/src/lib/dns/rrcollator.cc @@ -22,9 +22,11 @@ #include #include +using namespace isc::dns::rdata; +namespace ph = std::placeholders; + namespace isc { namespace dns { -using namespace rdata; class RRCollator::Impl { public: @@ -87,7 +89,6 @@ RRCollator::~RRCollator() { AddRRCallback RRCollator::getCallback() { - namespace ph = std::placeholders; return (std::bind(&RRCollator::Impl::addRR, this->impl_, ph::_1, ph::_2, ph::_3, ph::_4, ph::_5)); } diff --git a/src/lib/dns/zone_checker.cc b/src/lib/dns/zone_checker.cc index e87cb7850a..def989627f 100644 --- a/src/lib/dns/zone_checker.cc +++ b/src/lib/dns/zone_checker.cc @@ -22,6 +22,7 @@ using boost::lexical_cast; using std::string; +namespace ph = std::placeholders; namespace isc { namespace dns { @@ -177,8 +178,8 @@ checkZone(const Name& zone_name, const RRClass& zone_class, const ZoneCheckerCallbacks& callbacks) { bool had_error = false; ZoneCheckerCallbacks my_callbacks( - std::bind(errorWrapper, std::placeholders::_1, &callbacks, &had_error), - std::bind(&ZoneCheckerCallbacks::warn, &callbacks, std::placeholders::_1)); + std::bind(errorWrapper, ph::_1, &callbacks, &had_error), + std::bind(&ZoneCheckerCallbacks::warn, &callbacks, ph::_1)); checkSOA(zone_name, zone_class, zone_rrsets, my_callbacks); checkNS(zone_name, zone_class, zone_rrsets, my_callbacks); diff --git a/src/lib/http/client.cc b/src/lib/http/client.cc index bf1acc59e7..65dd721bd4 100644 --- a/src/lib/http/client.cc +++ b/src/lib/http/client.cc @@ -32,6 +32,7 @@ using namespace isc; using namespace isc::asiolink; using namespace isc::http; using namespace isc::util; +namespace ph = std::placeholders; namespace { @@ -833,7 +834,7 @@ Connection::doTransactionInternal(const HttpRequestPtr& request, static_cast(url_.getPort())); SocketCallback socket_cb(std::bind(&Connection::connectCallback, shared_from_this(), connect_callback, current_transid_, - std::placeholders::_1)); + ph::_1)); // Establish new connection or use existing connection. socket_.open(&endpoint, socket_cb); @@ -1002,8 +1003,8 @@ Connection::doSend(const uint64_t transid) { SocketCallback socket_cb(std::bind(&Connection::sendCallback, shared_from_this(), transid, - std::placeholders::_1, - std::placeholders::_2)); + ph::_1, + ph::_2)); try { socket_.asyncSend(&buf_[0], buf_.size(), socket_cb); @@ -1018,8 +1019,8 @@ Connection::doReceive(const uint64_t transid) { SocketCallback socket_cb(std::bind(&Connection::receiveCallback, shared_from_this(), transid, - std::placeholders::_1, - std::placeholders::_2)); + ph::_1, + ph::_2)); try { socket_.asyncReceive(static_cast(input_buf_.data()), input_buf_.size(), 0, diff --git a/src/lib/http/connection.cc b/src/lib/http/connection.cc index f2dbfd8f3e..cc843e78da 100644 --- a/src/lib/http/connection.cc +++ b/src/lib/http/connection.cc @@ -15,6 +15,7 @@ #include using namespace isc::asiolink; +namespace ph = std::placeholders; namespace { @@ -107,7 +108,7 @@ HttpConnection::asyncAccept() { // as needed. HttpAcceptorCallback cb = std::bind(&HttpConnection::acceptorCallback, shared_from_this(), - std::placeholders::_1); // error + ph::_1); // error try { acceptor_.asyncAccept(socket_, cb); @@ -134,8 +135,8 @@ HttpConnection::doRead(TransactionPtr transaction) { SocketCallback cb(std::bind(&HttpConnection::socketReadCallback, shared_from_this(), transaction, - std::placeholders::_1, // error - std::placeholders::_2)); //bytes_transferred + ph::_1, // error + ph::_2)); //bytes_transferred socket_.asyncReceive(static_cast(transaction->getInputBufData()), transaction->getInputBufSize(), 0, &endpoint, cb); @@ -155,8 +156,8 @@ HttpConnection::doWrite(HttpConnection::TransactionPtr transaction) { SocketCallback cb(std::bind(&HttpConnection::socketWriteCallback, shared_from_this(), transaction, - std::placeholders::_1, // error - std::placeholders::_2)); // bytes_transferred + ph::_1, // error + ph::_2)); // bytes_transferred socket_.asyncSend(transaction->getOutputBufData(), transaction->getOutputBufSize(), cb); diff --git a/src/lib/http/listener_impl.cc b/src/lib/http/listener_impl.cc index d6ab95f4bb..1a80f6817f 100644 --- a/src/lib/http/listener_impl.cc +++ b/src/lib/http/listener_impl.cc @@ -11,6 +11,7 @@ #include using namespace isc::asiolink; +namespace ph = std::placeholders; namespace isc { namespace http { @@ -88,8 +89,7 @@ HttpListenerImpl::accept() { // depends on the use case. HttpResponseCreatorPtr response_creator = creator_factory_->create(); HttpAcceptorCallback acceptor_callback = - std::bind(&HttpListenerImpl::acceptHandler, this, - std::placeholders::_1); + std::bind(&HttpListenerImpl::acceptHandler, this, ph::_1); HttpConnectionPtr conn = createConnection(response_creator, acceptor_callback); // Add this new connection to the pool. diff --git a/src/lib/process/d_controller.cc b/src/lib/process/d_controller.cc index ae14572ec0..b9ee7ce37f 100644 --- a/src/lib/process/d_controller.cc +++ b/src/lib/process/d_controller.cc @@ -21,6 +21,7 @@ using namespace isc::data; using namespace isc::config; +namespace ph = std::placeholders; namespace isc { namespace process { @@ -741,8 +742,7 @@ DControllerBase::initSignalHandling() { io_signal_set_.reset(new IOSignalSet(io_service_, std::bind(&DControllerBase:: processSignal, - this, - std::placeholders::_1))); + this, ph::_1))); // Register for the signals we wish to handle. io_signal_set_->add(SIGHUP); io_signal_set_->add(SIGINT); diff --git a/src/lib/process/daemon.cc b/src/lib/process/daemon.cc index aa42e21fb8..a7dba8af38 100644 --- a/src/lib/process/daemon.cc +++ b/src/lib/process/daemon.cc @@ -20,6 +20,7 @@ #include using namespace isc::data; +namespace ph = std::placeholders; /// @brief provides default implementation for basic daemon operations /// @@ -62,7 +63,7 @@ void Daemon::shutdown() { void Daemon::handleSignal() { if (signal_set_ && signal_handler_) { - signal_set_->handleNext(std::bind(signal_handler_, std::placeholders::_1)); + signal_set_->handleNext(std::bind(signal_handler_, ph::_1)); } } diff --git a/src/lib/process/io_service_signal.cc b/src/lib/process/io_service_signal.cc index 448fd1171f..0e80723f89 100644 --- a/src/lib/process/io_service_signal.cc +++ b/src/lib/process/io_service_signal.cc @@ -16,6 +16,7 @@ #include using namespace isc::asiolink; +namespace ph = std::placeholders; namespace isc { namespace process { @@ -83,9 +84,7 @@ IOSignalSetImpl::callback(const boost::system::error_code& ec, int signum) { void IOSignalSetImpl::install() { signal_set_.async_wait(std::bind(&IOSignalSetImpl::callback, - shared_from_this(), - std::placeholders::_1, - std::placeholders::_2)); + shared_from_this(), ph::_1, ph::_2)); } void diff --git a/src/lib/process/tests/io_service_signal_unittests.cc b/src/lib/process/tests/io_service_signal_unittests.cc index f313998a59..dbbe0cfbbb 100644 --- a/src/lib/process/tests/io_service_signal_unittests.cc +++ b/src/lib/process/tests/io_service_signal_unittests.cc @@ -14,6 +14,8 @@ #include #include +namespace ph = std::placeholders; + namespace isc { namespace process { @@ -53,7 +55,7 @@ public: io_signal_set_.reset(new IOSignalSet( io_service_, std::bind(&IOSignalTest::processSignal, - this, std::placeholders::_1))); + this, ph::_1))); } /// @brief Destructor. diff --git a/src/lib/util/process_spawn.cc b/src/lib/util/process_spawn.cc index 15302bbeec..1cc3717356 100644 --- a/src/lib/util/process_spawn.cc +++ b/src/lib/util/process_spawn.cc @@ -18,6 +18,8 @@ #include #include +namespace ph = std::placeholders; + namespace isc { namespace util { @@ -154,7 +156,7 @@ ProcessSpawnImpl::ProcessSpawnImpl(const std::string& executable, // Set the handler which is invoked immediately when the signal // is received. signals_->setOnReceiptHandler(std::bind(&ProcessSpawnImpl::waitForProcess, - this, std::placeholders::_1)); + this, ph::_1)); // Conversion of the arguments to the C-style array we start by setting // all pointers within an array to NULL to indicate that they haven't // been allocated yet.