From e5426b9f657999ba0a5ff13acb4d4b9e52761b11 Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Wed, 28 Jun 2017 19:08:07 +0000 Subject: [PATCH] Ansify entry and exit points. MFC after: 1 month --- contrib/ipfilter/lib/hostname.c | 17 ++++++++--------- contrib/ipfilter/lib/portname.c | 10 +++++----- contrib/ipfilter/lib/printstate.c | 9 +++------ 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/contrib/ipfilter/lib/hostname.c b/contrib/ipfilter/lib/hostname.c index 28ead89a54f8..3b179954bbff 100644 --- a/contrib/ipfilter/lib/hostname.c +++ b/contrib/ipfilter/lib/hostname.c @@ -10,9 +10,8 @@ #include "ipf.h" -char *hostname(family, ip) - int family; - void *ip; +char * +hostname(int family, void *ip) { static char hostbuf[MAXHOSTNAMELEN+1]; struct hostent *hp; @@ -24,7 +23,7 @@ char *hostname(family, ip) if (family == AF_INET) { ipa.s_addr = *(u_32_t *)ip; if (ipa.s_addr == htonl(0xfedcba98)) - return "test.host.dots"; + return ("test.host.dots"); } if ((opts & OPT_NORESOLVE) == 0) { @@ -34,7 +33,7 @@ char *hostname(family, ip) *hp->h_name != '\0') { strncpy(hostbuf, hp->h_name, sizeof(hostbuf)); hostbuf[sizeof(hostbuf) - 1] = '\0'; - return hostbuf; + return (hostbuf); } np = getnetbyaddr(ipa.s_addr, AF_INET); @@ -42,19 +41,19 @@ char *hostname(family, ip) *np->n_name != '\0') { strncpy(hostbuf, np->n_name, sizeof(hostbuf)); hostbuf[sizeof(hostbuf) - 1] = '\0'; - return hostbuf; + return (hostbuf); } } } if (family == AF_INET) { - return inet_ntoa(ipa); + return (inet_ntoa(ipa)); } #ifdef USE_INET6 (void) inet_ntop(AF_INET6, ip, hostbuf, sizeof(hostbuf) - 1); hostbuf[MAXHOSTNAMELEN] = '\0'; - return hostbuf; + return (hostbuf); #else - return "IPv6"; + return ("IPv6"); #endif } diff --git a/contrib/ipfilter/lib/portname.c b/contrib/ipfilter/lib/portname.c index 59345f4b2f57..925eace62532 100644 --- a/contrib/ipfilter/lib/portname.c +++ b/contrib/ipfilter/lib/portname.c @@ -10,8 +10,8 @@ #include "ipf.h" -char *portname(pr, port) - int pr, port; +char * +portname(int pr, int port) { static char buf[32]; struct protoent *p = NULL; @@ -28,16 +28,16 @@ char *portname(pr, port) NULL : sv1; } if (sv) - return buf; + return (buf); } else if ((pr != -2) && (p = getprotobynumber(pr))) { if ((sv = getservbyport(htons(port), p->p_name))) { strncpy(buf, sv->s_name, sizeof(buf)-1); buf[sizeof(buf)-1] = '\0'; - return buf; + return (buf); } } } (void) sprintf(buf, "%d", port); - return buf; + return (buf); } diff --git a/contrib/ipfilter/lib/printstate.c b/contrib/ipfilter/lib/printstate.c index fc85a70dcbe2..8832a723e9f1 100644 --- a/contrib/ipfilter/lib/printstate.c +++ b/contrib/ipfilter/lib/printstate.c @@ -11,10 +11,7 @@ ipstate_t * -printstate(sp, opts, now) - ipstate_t *sp; - int opts; - u_long now; +printstate(ipstate_t *sp, int opts, u_long now) { struct protoent *pr; synclist_t ipsync; @@ -210,7 +207,7 @@ printstate(sp, opts, now) if (kmemcpy((char *)&ipsync, (u_long)sp->is_sync, sizeof(ipsync))) { PRINTF("status could not be retrieved\n"); - return NULL; + return (NULL); } PRINTF("idx %d num %d v %d pr %d rev %d\n", @@ -220,5 +217,5 @@ printstate(sp, opts, now) PRINTF("not synchronized\n"); } - return sp->is_next; + return (sp->is_next); }