diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-05-18 23:54:09 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-05-18 23:54:09 +0200 |
commit | 0a2a20509b344dd3813d9fc16e21fe8fb57e4e0e (patch) | |
tree | 4e7b860b0ff367aa17b2e9de5be8a3e29bb4bb2b | |
parent | 33128015369926300623c880b5ab8e2c21e985b5 (diff) | |
download | curl-bagder/void-printable.tar.gz |
fixup (void)-prefix the Curl_inet_ntop calls toobagder/void-printable
... and rearrange some whitespace for readability
-rw-r--r-- | lib/hostip.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/lib/hostip.c b/lib/hostip.c index 633d3dc8c..025d9a784 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -140,32 +140,26 @@ int Curl_num_addresses(const struct Curl_addrinfo *addr) void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, size_t bufsize) { - const struct sockaddr_in *sa4; - const struct in_addr *ipaddr4; -#ifdef ENABLE_IPV6 - const struct sockaddr_in6 *sa6; - const struct in6_addr *ipaddr6; -#endif DEBUGASSERT(bufsize); buf[0] = 0; switch(ai->ai_family) { - case AF_INET: - sa4 = (const void *)ai->ai_addr; - ipaddr4 = &sa4->sin_addr; - Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, - bufsize); - return; + case AF_INET: { + const struct sockaddr_in *sa4 = (const void *)ai->ai_addr; + const struct in_addr *ipaddr4 = &sa4->sin_addr; + (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize); + break; + } #ifdef ENABLE_IPV6 - case AF_INET6: - sa6 = (const void *)ai->ai_addr; - ipaddr6 = &sa6->sin6_addr; - Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, - bufsize); - return; + case AF_INET6: { + const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr; + const struct in6_addr *ipaddr6 = &sa6->sin6_addr; + (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize); + break; + } #endif default: - break; + break; } } |