From 35bbbf736c75f13c2bf9f6d6bdc2feecd42072cb Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 3 Dec 2007 20:42:09 +0100 Subject: [PATCH] net.c: Make host_and_port() static. It's only used in net.c. Some more trivial cleanups also. --- net.c | 12 ++++++------ net.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/net.c b/net.c index e21f4029..5d7c3fef 100644 --- a/net.c +++ b/net.c @@ -268,7 +268,7 @@ int para_listen(unsigned l3type, unsigned l4type, unsigned short port) * * \sa getnameinfo(3). */ -char *host_and_port(struct sockaddr *sa, socklen_t len) +static char *host_and_port(struct sockaddr *sa, socklen_t len) { static char output[NI_MAXHOST + NI_MAXSERV + 2]; char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; @@ -276,12 +276,12 @@ char *host_and_port(struct sockaddr *sa, socklen_t len) ret = getnameinfo(sa, len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV); - if (ret) { - PARA_WARNING_LOG("hostname lookup error (%s).\n", gai_strerror(ret)); + if (ret) { + PARA_WARNING_LOG("hostname lookup error (%s).\n", + gai_strerror(ret)); sprintf(output, "(unknown)"); - } else { + } else sprintf(output, "%s#%s", hbuf, sbuf); - } return output; } @@ -312,7 +312,7 @@ static char *__get_sock_name(int fd, int (*getname)(int, struct sockaddr*, return host_and_port((struct sockaddr *)&ss, sslen); } -char *local_name(int sockfd) +char *local_name(int sockfd) { return __get_sock_name(sockfd, getsockname); } diff --git a/net.h b/net.h index c4412b2f..d73ffccb 100644 --- a/net.h +++ b/net.h @@ -38,7 +38,6 @@ extern int makesock(unsigned l3type, unsigned l4type, int passive, extern int para_listen(unsigned l3type, unsigned l4type, unsigned short port); /** Pretty-printing of IPv4/6 socket addresses */ -extern char *host_and_port(struct sockaddr *sa, socklen_t len); extern char *local_name(int sockfd); extern char *remote_name(int sockfd); -- 2.39.5