From 3339ce2cc0be9cc15a6cd9571025846edd1bef20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Mon, 23 Sep 2019 22:17:27 +0200 Subject: [PATCH] Trivial little naming changes --- src/irc/irc_client.cpp | 2 +- src/irc/irc_client.hpp | 2 +- src/network/tcp_client_socket_handler.cpp | 9 ++++----- src/xmpp/xmpp_component.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 0b5715e..de38d42 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -398,7 +398,7 @@ void IrcClient::parse_in_buffer(const size_t) } } -void IrcClient::actual_send(std::pair message_pair) +void IrcClient::actual_send(std::pair&& message_pair) { const IrcMessage& message = message_pair.first; const MessageCallback& callback = message_pair.second; diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index 674f3ff..cfb3d21 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -92,7 +92,7 @@ public: */ void send_message(IrcMessage message, MessageCallback callback={}, bool throttle=true); void send_raw(const std::string& txt); - void actual_send(std::pair message_pair); + void actual_send(std::pair&& message_pair); /** * Send the PONG irc command */ diff --git a/src/network/tcp_client_socket_handler.cpp b/src/network/tcp_client_socket_handler.cpp index 9dda73d..6f67f02 100644 --- a/src/network/tcp_client_socket_handler.cpp +++ b/src/network/tcp_client_socket_handler.cpp @@ -46,15 +46,14 @@ void TCPClientSocketHandler::init_socket(const struct addrinfo* rp) else { utils::ScopeGuard sg([result](){ freeaddrinfo(result); }); - struct addrinfo* rp; - for (rp = result; rp; rp = rp->ai_next) + for (; result; result = result->ai_next) { if ((::bind(this->socket, - reinterpret_cast(rp->ai_addr), - rp->ai_addrlen)) == 0) + reinterpret_cast(result->ai_addr), + result->ai_addrlen)) == 0) break; } - if (!rp) + if (!result) log_error("Failed to bind socket to ", this->bind_addr, ": ", strerror(errno)); else diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index 35e1672..a16c0f5 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -298,8 +298,8 @@ void XmppComponent::send_message(const std::string& from, Xmpp::body&& body, con { XmlSubNode private_node(message, "private"); private_node["xmlns"] = "urn:xmpp:carbons:2"; - XmlSubNode nocopy(message, "no-copy"); - nocopy["xmlns"] = "urn:xmpp:hints"; + XmlSubNode nocopy_node(message, "no-copy"); + nocopy_node["xmlns"] = "urn:xmpp:hints"; } if (muc_private) { @@ -590,8 +590,8 @@ void XmppComponent::send_version(const std::string& id, const std::string& jid_t name.set_inner("biboumi"); } { - XmlSubNode version(query, "version"); - version.set_inner(SOFTWARE_VERSION); + XmlSubNode version_node(query, "version"); + version_node.set_inner(SOFTWARE_VERSION); } { XmlSubNode os(query, "os"); -- 2.45.2