diff options
author | louiz’ <louiz@louiz.org> | 2017-03-08 19:04:15 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-03-08 19:04:15 +0100 |
commit | f0bc6c83a8eb548d0a3edbf7c16a6922bfd24ba5 (patch) | |
tree | c9df36ef6781dfa56d2a3fee5b68390aa1e9ceb5 | |
parent | cd92baae3f0de8b841b5bbfdb02e4fa95acd52c1 (diff) | |
download | biboumi-f0bc6c83a8eb548d0a3edbf7c16a6922bfd24ba5.tar.gz biboumi-f0bc6c83a8eb548d0a3edbf7c16a6922bfd24ba5.tar.bz2 biboumi-f0bc6c83a8eb548d0a3edbf7c16a6922bfd24ba5.tar.xz biboumi-f0bc6c83a8eb548d0a3edbf7c16a6922bfd24ba5.zip |
Pass the shared_ptr by reference, to avoid useless copies
-rw-r--r-- | louloulibs/network/dns_handler.cpp | 2 | ||||
-rw-r--r-- | louloulibs/network/dns_handler.hpp | 2 | ||||
-rw-r--r-- | louloulibs/network/dns_socket_handler.cpp | 2 | ||||
-rw-r--r-- | louloulibs/network/dns_socket_handler.hpp | 2 | ||||
-rw-r--r-- | louloulibs/network/socket_handler.hpp | 2 | ||||
-rw-r--r-- | louloulibs/network/tcp_client_socket_handler.cpp | 2 | ||||
-rw-r--r-- | louloulibs/network/tcp_client_socket_handler.hpp | 2 | ||||
-rw-r--r-- | louloulibs/network/tcp_server_socket.hpp | 2 | ||||
-rw-r--r-- | louloulibs/network/tcp_socket_handler.cpp | 2 | ||||
-rw-r--r-- | louloulibs/network/tcp_socket_handler.hpp | 2 | ||||
-rw-r--r-- | louloulibs/xmpp/xmpp_component.cpp | 2 | ||||
-rw-r--r-- | louloulibs/xmpp/xmpp_component.hpp | 2 | ||||
-rw-r--r-- | src/bridge/bridge.cpp | 2 | ||||
-rw-r--r-- | src/bridge/bridge.hpp | 2 | ||||
-rw-r--r-- | src/identd/identd_server.hpp | 2 | ||||
-rw-r--r-- | src/identd/identd_socket.cpp | 2 | ||||
-rw-r--r-- | src/identd/identd_socket.hpp | 2 | ||||
-rw-r--r-- | src/irc/irc_client.cpp | 2 | ||||
-rw-r--r-- | src/irc/irc_client.hpp | 2 | ||||
-rw-r--r-- | src/xmpp/biboumi_component.cpp | 2 | ||||
-rw-r--r-- | src/xmpp/biboumi_component.hpp | 2 |
21 files changed, 21 insertions, 21 deletions
diff --git a/louloulibs/network/dns_handler.cpp b/louloulibs/network/dns_handler.cpp index fbd2763..641c087 100644 --- a/louloulibs/network/dns_handler.cpp +++ b/louloulibs/network/dns_handler.cpp @@ -17,7 +17,7 @@ using namespace std::string_literals; std::unique_ptr<DNSSocketHandler> DNSHandler::socket_handler{}; -DNSHandler::DNSHandler(std::shared_ptr<Poller> poller) +DNSHandler::DNSHandler(std::shared_ptr<Poller>& poller) { dns_init(nullptr, 0); const auto socket = dns_open(nullptr); diff --git a/louloulibs/network/dns_handler.hpp b/louloulibs/network/dns_handler.hpp index 78ffe4d..416f85f 100644 --- a/louloulibs/network/dns_handler.hpp +++ b/louloulibs/network/dns_handler.hpp @@ -14,7 +14,7 @@ class Poller; class DNSHandler { public: - explicit DNSHandler(std::shared_ptr<Poller> poller); + explicit DNSHandler(std::shared_ptr<Poller>& poller); ~DNSHandler() = default; DNSHandler(const DNSHandler&) = delete; diff --git a/louloulibs/network/dns_socket_handler.cpp b/louloulibs/network/dns_socket_handler.cpp index ad744a9..84e5625 100644 --- a/louloulibs/network/dns_socket_handler.cpp +++ b/louloulibs/network/dns_socket_handler.cpp @@ -7,7 +7,7 @@ #include <udns.h> -DNSSocketHandler::DNSSocketHandler(std::shared_ptr<Poller> poller, +DNSSocketHandler::DNSSocketHandler(std::shared_ptr<Poller>& poller, const socket_t socket): SocketHandler(poller, socket) { diff --git a/louloulibs/network/dns_socket_handler.hpp b/louloulibs/network/dns_socket_handler.hpp index e12f145..fc5f41f 100644 --- a/louloulibs/network/dns_socket_handler.hpp +++ b/louloulibs/network/dns_socket_handler.hpp @@ -12,7 +12,7 @@ class DNSSocketHandler: public SocketHandler { public: - explicit DNSSocketHandler(std::shared_ptr<Poller> poller, const socket_t socket); + explicit DNSSocketHandler(std::shared_ptr<Poller>& poller, const socket_t socket); ~DNSSocketHandler(); DNSSocketHandler(const DNSSocketHandler&) = delete; DNSSocketHandler(DNSSocketHandler&&) = delete; diff --git a/louloulibs/network/socket_handler.hpp b/louloulibs/network/socket_handler.hpp index 607a106..6a7220e 100644 --- a/louloulibs/network/socket_handler.hpp +++ b/louloulibs/network/socket_handler.hpp @@ -10,7 +10,7 @@ using socket_t = int; class SocketHandler { public: - explicit SocketHandler(std::shared_ptr<Poller> poller, const socket_t socket): + explicit SocketHandler(std::shared_ptr<Poller>& poller, const socket_t socket): poller(poller), socket(socket) {} diff --git a/louloulibs/network/tcp_client_socket_handler.cpp b/louloulibs/network/tcp_client_socket_handler.cpp index 530c3d9..4628703 100644 --- a/louloulibs/network/tcp_client_socket_handler.cpp +++ b/louloulibs/network/tcp_client_socket_handler.cpp @@ -11,7 +11,7 @@ using namespace std::string_literals; -TCPClientSocketHandler::TCPClientSocketHandler(std::shared_ptr<Poller> poller): +TCPClientSocketHandler::TCPClientSocketHandler(std::shared_ptr<Poller>& poller): TCPSocketHandler(poller), hostname_resolution_failed(false), connected(false), diff --git a/louloulibs/network/tcp_client_socket_handler.hpp b/louloulibs/network/tcp_client_socket_handler.hpp index 75e1364..74caca9 100644 --- a/louloulibs/network/tcp_client_socket_handler.hpp +++ b/louloulibs/network/tcp_client_socket_handler.hpp @@ -5,7 +5,7 @@ class TCPClientSocketHandler: public TCPSocketHandler { public: - TCPClientSocketHandler(std::shared_ptr<Poller> poller); + TCPClientSocketHandler(std::shared_ptr<Poller>& poller); ~TCPClientSocketHandler(); /** * Connect to the remote server, and call on_connected() if this diff --git a/louloulibs/network/tcp_server_socket.hpp b/louloulibs/network/tcp_server_socket.hpp index 7ea49ab..c511962 100644 --- a/louloulibs/network/tcp_server_socket.hpp +++ b/louloulibs/network/tcp_server_socket.hpp @@ -18,7 +18,7 @@ template <typename RemoteSocketType> class TcpSocketServer: public SocketHandler { public: - TcpSocketServer(std::shared_ptr<Poller> poller, const uint16_t port): + TcpSocketServer(std::shared_ptr<Poller>& poller, const uint16_t port): SocketHandler(poller, -1) { if ((this->socket = ::socket(AF_INET6, SOCK_STREAM, 0)) == -1) diff --git a/louloulibs/network/tcp_socket_handler.cpp b/louloulibs/network/tcp_socket_handler.cpp index 6aef2b1..7eebae0 100644 --- a/louloulibs/network/tcp_socket_handler.cpp +++ b/louloulibs/network/tcp_socket_handler.cpp @@ -44,7 +44,7 @@ using namespace std::chrono_literals; namespace ph = std::placeholders; -TCPSocketHandler::TCPSocketHandler(std::shared_ptr<Poller> poller): +TCPSocketHandler::TCPSocketHandler(std::shared_ptr<Poller>& poller): SocketHandler(poller, -1), use_tls(false) #ifdef BOTAN_FOUND diff --git a/louloulibs/network/tcp_socket_handler.hpp b/louloulibs/network/tcp_socket_handler.hpp index 600405d..3ee2f47 100644 --- a/louloulibs/network/tcp_socket_handler.hpp +++ b/louloulibs/network/tcp_socket_handler.hpp @@ -60,7 +60,7 @@ class TCPSocketHandler: public SocketHandler protected: ~TCPSocketHandler(); public: - explicit TCPSocketHandler(std::shared_ptr<Poller> poller); + explicit TCPSocketHandler(std::shared_ptr<Poller>& poller); TCPSocketHandler(const TCPSocketHandler&) = delete; TCPSocketHandler(TCPSocketHandler&&) = delete; TCPSocketHandler& operator=(const TCPSocketHandler&) = delete; diff --git a/louloulibs/xmpp/xmpp_component.cpp b/louloulibs/xmpp/xmpp_component.cpp index e40b1e4..5d98e58 100644 --- a/louloulibs/xmpp/xmpp_component.cpp +++ b/louloulibs/xmpp/xmpp_component.cpp @@ -39,7 +39,7 @@ static std::set<std::string> kickable_errors{ "malformed-error" }; -XmppComponent::XmppComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret): +XmppComponent::XmppComponent(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& secret): TCPClientSocketHandler(poller), ever_auth(false), first_connection_try(true), diff --git a/louloulibs/xmpp/xmpp_component.hpp b/louloulibs/xmpp/xmpp_component.hpp index a9bac0f..16d7480 100644 --- a/louloulibs/xmpp/xmpp_component.hpp +++ b/louloulibs/xmpp/xmpp_component.hpp @@ -43,7 +43,7 @@ class XmppComponent: public TCPClientSocketHandler { public: - explicit XmppComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret); + explicit XmppComponent(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& secret); virtual ~XmppComponent() = default; XmppComponent(const XmppComponent&) = delete; diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index 573e8d7..7e2d8c1 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -29,7 +29,7 @@ static std::string in_encoding_for(const Bridge& bridge, const Iid& iid) #endif } -Bridge::Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller> poller): +Bridge::Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller>& poller): user_jid(user_jid), xmpp(xmpp), poller(poller) diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp index b165650..73daae7 100644 --- a/src/bridge/bridge.hpp +++ b/src/bridge/bridge.hpp @@ -38,7 +38,7 @@ using irc_responder_callback_t = std::function<bool(const std::string& irc_hostn class Bridge { public: - explicit Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller> poller); + explicit Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller>& poller); ~Bridge() = default; Bridge(const Bridge&) = delete; diff --git a/src/identd/identd_server.hpp b/src/identd/identd_server.hpp index 5f74976..b1c8ec8 100644 --- a/src/identd/identd_server.hpp +++ b/src/identd/identd_server.hpp @@ -10,7 +10,7 @@ class BiboumiComponent; class IdentdServer: public TcpSocketServer<IdentdSocket> { public: - IdentdServer(const BiboumiComponent& biboumi_component, std::shared_ptr<Poller> poller, const uint16_t port): + IdentdServer(const BiboumiComponent& biboumi_component, std::shared_ptr<Poller>& poller, const uint16_t port): TcpSocketServer<IdentdSocket>(poller, port), biboumi_component(biboumi_component) {} diff --git a/src/identd/identd_socket.cpp b/src/identd/identd_socket.cpp index a94f172..b85257c 100644 --- a/src/identd/identd_socket.cpp +++ b/src/identd/identd_socket.cpp @@ -8,7 +8,7 @@ #include <logger/logger.hpp> -IdentdSocket::IdentdSocket(std::shared_ptr<Poller> poller, const socket_t socket, TcpSocketServer<IdentdSocket>& server): +IdentdSocket::IdentdSocket(std::shared_ptr<Poller>& poller, const socket_t socket, TcpSocketServer<IdentdSocket>& server): TCPSocketHandler(poller), server(dynamic_cast<IdentdServer&>(server)) { diff --git a/src/identd/identd_socket.hpp b/src/identd/identd_socket.hpp index 1c2bd27..10cb797 100644 --- a/src/identd/identd_socket.hpp +++ b/src/identd/identd_socket.hpp @@ -17,7 +17,7 @@ class TcpSocketServer; class IdentdSocket: public TCPSocketHandler { public: - IdentdSocket(std::shared_ptr<Poller> poller, const socket_t socket, TcpSocketServer<IdentdSocket>& server); + IdentdSocket(std::shared_ptr<Poller>& poller, const socket_t socket, TcpSocketServer<IdentdSocket>& server); ~IdentdSocket() = default; std::string generate_answer(const BiboumiComponent& biboumi, uint16_t local, uint16_t remote); diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 6813bba..d0970c1 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -128,7 +128,7 @@ static const std::unordered_map<std::string, {"502", {&IrcClient::on_generic_error, {2, 0}}}, }; -IrcClient::IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname, +IrcClient::IrcClient(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& nickname, const std::string& username, const std::string& realname, const std::string& user_hostname, Bridge& bridge): diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index 4b942ad..009d0c9 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -26,7 +26,7 @@ class Bridge; class IrcClient: public TCPClientSocketHandler { public: - explicit IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname, + explicit IrcClient(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& nickname, const std::string& username, const std::string& realname, const std::string& user_hostname, Bridge& bridge); diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 2783b93..4ba5e65 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -44,7 +44,7 @@ static std::set<std::string> kickable_errors{ }; -BiboumiComponent::BiboumiComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret): +BiboumiComponent::BiboumiComponent(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& secret): XmppComponent(poller, hostname, secret), irc_server_adhoc_commands_handler(*this), irc_channel_adhoc_commands_handler(*this) diff --git a/src/xmpp/biboumi_component.hpp b/src/xmpp/biboumi_component.hpp index aa0c3db..1d25e0e 100644 --- a/src/xmpp/biboumi_component.hpp +++ b/src/xmpp/biboumi_component.hpp @@ -27,7 +27,7 @@ using iq_responder_callback_t = std::function<void(Bridge* bridge, const Stanza& class BiboumiComponent: public XmppComponent { public: - explicit BiboumiComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret); + explicit BiboumiComponent(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& secret); ~BiboumiComponent() = default; BiboumiComponent(const BiboumiComponent&) = delete; |