summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-07-22 10:13:54 +0200
committerMax Kellermann <max@duempel.org>2015-07-22 10:26:18 +0200
commitd4d9a85ad8d719ee4b5edba481a4a641c4b3c44c (patch)
treed6b5a945603194ae51b46a7ddb5828abbddb688f /src/net
parent6f22452b54d6d16d01855a0be18cbee162e141b6 (diff)
net/ToString: make variables more local
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ToString.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/net/ToString.cxx b/src/net/ToString.cxx
index 49a5067a8..28c333374 100644
--- a/src/net/ToString.cxx
+++ b/src/net/ToString.cxx
@@ -82,11 +82,6 @@ sockaddr_to_string(SocketAddress address)
const struct sockaddr_in6 *a6 = (const struct sockaddr_in6 *)
address.GetAddress();
struct sockaddr_in a4;
-#endif
- int ret;
- char host[NI_MAXHOST], serv[NI_MAXSERV];
-
-#if defined(HAVE_IPV6) && defined(IN6_IS_ADDR_V4MAPPED)
if (address.GetFamily() == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED(&a6->sin6_addr)) {
/* convert "::ffff:127.0.0.1" to "127.0.0.1" */
@@ -101,9 +96,10 @@ sockaddr_to_string(SocketAddress address)
}
#endif
- ret = getnameinfo(address.GetAddress(), address.GetSize(),
- host, sizeof(host), serv, sizeof(serv),
- NI_NUMERICHOST|NI_NUMERICSERV);
+ char host[NI_MAXHOST], serv[NI_MAXSERV];
+ int ret = getnameinfo(address.GetAddress(), address.GetSize(),
+ host, sizeof(host), serv, sizeof(serv),
+ NI_NUMERICHOST|NI_NUMERICSERV);
if (ret != 0)
return "unknown";