aboutsummaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-12-27 01:06:35 -0800
committerGarrett D'Amore <garrett@damore.org>2019-12-27 01:06:35 -0800
commitc590be7c6ead811f929041393a061e4068f35b00 (patch)
tree967b495c0a0865996f2b849b6b475a4beb67a1a0 /src/platform
parent1bb46ca346e666fd9c60e7be06ef7a1c927ca2f1 (diff)
downloadnng-c590be7c6ead811f929041393a061e4068f35b00.tar.gz
nng-c590be7c6ead811f929041393a061e4068f35b00.tar.bz2
nng-c590be7c6ead811f929041393a061e4068f35b00.zip
fixes #1051 nni_ntop is unused
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/posix/posix_resolv_gai.c41
-rw-r--r--src/platform/windows/win_resolv.c43
2 files changed, 1 insertions, 83 deletions
diff --git a/src/platform/posix/posix_resolv_gai.c b/src/platform/posix/posix_resolv_gai.c
index b082eac6..9e577403 100644
--- a/src/platform/posix/posix_resolv_gai.c
+++ b/src/platform/posix/posix_resolv_gai.c
@@ -345,47 +345,6 @@ resolv_worker(void *notused)
}
int
-nni_ntop(const nni_sockaddr *sa, char *ipstr, char *portstr)
-{
- const void *ap;
- uint16_t port;
- int af;
- switch (sa->s_family) {
- case NNG_AF_INET:
- ap = &sa->s_in.sa_addr;
- port = sa->s_in.sa_port;
- af = AF_INET;
- break;
- case NNG_AF_INET6:
- ap = &sa->s_in6.sa_addr;
- port = sa->s_in6.sa_port;
- af = AF_INET6;
- break;
- default:
- return (NNG_EINVAL);
- }
- if (ipstr != NULL) {
- if (af == AF_INET6) {
- size_t l;
- ipstr[0] = '[';
- inet_ntop(af, ap, ipstr + 1, INET6_ADDRSTRLEN);
- l = strlen(ipstr);
- ipstr[l++] = ']';
- ipstr[l++] = '\0';
- } else {
- inet_ntop(af, ap, ipstr, INET6_ADDRSTRLEN);
- }
- }
- if (portstr != NULL) {
-#ifdef NNG_LITTLE_ENDIAN
- port = ((port >> 8) & 0xff) | ((port & 0xff) << 8);
-#endif
- snprintf(portstr, 6, "%u", port);
- }
- return (0);
-}
-
-int
nni_posix_resolv_sysinit(void)
{
nni_mtx_init(&resolv_mtx);
diff --git a/src/platform/windows/win_resolv.c b/src/platform/windows/win_resolv.c
index e01dba3b..53a39118 100644
--- a/src/platform/windows/win_resolv.c
+++ b/src/platform/windows/win_resolv.c
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -308,47 +308,6 @@ resolv_worker(void *notused)
}
int
-nni_ntop(const nni_sockaddr *sa, char *ipstr, char *portstr)
-{
- void * ap;
- uint16_t port;
- int af;
- switch (sa->s_family) {
- case NNG_AF_INET:
- ap = (void *) &sa->s_in.sa_addr;
- port = sa->s_in.sa_port;
- af = AF_INET;
- break;
- case NNG_AF_INET6:
- ap = (void *) &sa->s_in6.sa_addr;
- port = sa->s_in6.sa_port;
- af = AF_INET6;
- break;
- default:
- return (NNG_EINVAL);
- }
- if (ipstr != NULL) {
- if (af == AF_INET6) {
- size_t l;
- ipstr[0] = '[';
- InetNtopA(af, ap, ipstr + 1, INET6_ADDRSTRLEN);
- l = strlen(ipstr);
- ipstr[l++] = ']';
- ipstr[l++] = '\0';
- } else {
- InetNtopA(af, ap, ipstr, INET6_ADDRSTRLEN);
- }
- }
- if (portstr != NULL) {
-#ifdef NNG_LITTLE_ENDIAN
- port = ((port >> 8) & 0xff) | ((port & 0xff) << 8);
-#endif
- snprintf(portstr, 6, "%u", port);
- }
- return (0);
-}
-
-int
nni_win_resolv_sysinit(void)
{
nni_mtx_init(&resolv_mtx);