NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/46006: Ansify getnameinfo.c.



>Number:         46006
>Category:       lib
>Synopsis:       Ansify getnameinfo.c.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 12 12:05:00 +0000 2012
>Originator:     Henning Petersen
>Release:        
>Organization:
>Environment:
>Description:
ANSIfy getnameinfo.c.
Added keyword restrict.
>How-To-Repeat:

>Fix:
diff -u -p -r1.50 getnameinfo.c
--- lib/libc/net/getnameinfo.c  29 Jun 2010 14:44:19 -0000      1.50
+++ lib/libc/net/getnameinfo.c  12 Feb 2012 06:31:39 -0000
@@ -95,32 +95,29 @@ struct sockinet {
        u_short si_port;
 };
 
-static int getnameinfo_inet __P((const struct sockaddr *, socklen_t, char *,
-    socklen_t, char *, socklen_t, int));
+static int getnameinfo_inet(const struct sockaddr *, socklen_t, char *,
+    socklen_t, char *, socklen_t, int);
 #ifdef INET6
-static int ip6_parsenumeric __P((const struct sockaddr *, const char *, char *,
-                                socklen_t, int));
-static int ip6_sa2str __P((const struct sockaddr_in6 *, char *, size_t,
-                                int));
+static int ip6_parsenumeric(const struct sockaddr *, const char *, char *,
+                                socklen_t, int);
+static int ip6_sa2str(const struct sockaddr_in6 *, char *, size_t,
+                                int);
 #endif
-static int getnameinfo_atalk __P((const struct sockaddr *, socklen_t, char *,
-    socklen_t, char *, socklen_t, int));
+static int getnameinfo_atalk(const struct sockaddr *, socklen_t, char *,
+    socklen_t, char *, socklen_t, int);
 
-static int getnameinfo_link __P((const struct sockaddr *, socklen_t, char *,
-    socklen_t, char *, socklen_t, int));
-static int hexname __P((const u_int8_t *, size_t, char *, socklen_t));
+static int getnameinfo_link(const struct sockaddr *, socklen_t, char *,
+    socklen_t, char *, socklen_t, int);
+static int hexname(const u_int8_t *, size_t, char *, socklen_t);
 
 /*
  * Top-level getnameinfo() code.  Look at the address family, and pick an
  * appropriate function to call.
  */
 int
-getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
-       const struct sockaddr *sa;
-       socklen_t salen;
-       char *host, *serv;
-       socklen_t hostlen, servlen;
-       int flags;
+getnameinfo(const struct sockaddr * __restrict sa, socklen_t salen,
+       char * __restrict host, socklen_t hostlen, char * __restrict serv,
+       socklen_t servlen, int flags)
 {
 
        switch (sa->sa_family) {
@@ -204,14 +201,8 @@ errout:
  * Format an IPv4 or IPv6 sockaddr into a printable string.
  */
 static int
-getnameinfo_inet(sa, salen, host, hostlen, serv, servlen, flags)
-       const struct sockaddr *sa;
-       socklen_t salen;
-       char *host;
-       socklen_t hostlen;
-       char *serv;
-       socklen_t servlen;
-       int flags;
+getnameinfo_inet(const struct sockaddr *sa, socklen_t salen, char *host,
+       socklen_t hostlen, char *serv, socklen_t servlen, int flags)
 {
        const struct afd *afd;
        struct servent *sp;
@@ -401,12 +392,8 @@ getnameinfo_inet(sa, salen, host, hostle
 
 #ifdef INET6
 static int
-ip6_parsenumeric(sa, addr, host, hostlen, flags)
-       const struct sockaddr *sa;
-       const char *addr;
-       char *host;
-       socklen_t hostlen;
-       int flags;
+ip6_parsenumeric(const struct sockaddr *sa, const char *addr,
+       char *host, socklen_t hostlen, int flags)
 {
        size_t numaddrlen;
        char numaddr[512];
@@ -446,11 +433,8 @@ ip6_parsenumeric(sa, addr, host, hostlen
 
 /* ARGSUSED */
 static int
-ip6_sa2str(sa6, buf, bufsiz, flags)
-       const struct sockaddr_in6 *sa6;
-       char *buf;
-       size_t bufsiz;
-       int flags;
+ip6_sa2str(const struct sockaddr_in6 *sa6, char *buf,
+       size_t bufsiz, int flags)
 {
        unsigned int ifindex;
        const struct in6_addr *a6;
@@ -498,9 +482,8 @@ ip6_sa2str(sa6, buf, bufsiz, flags)
  */
 /* ARGSUSED */
 static int
-getnameinfo_link(const struct sockaddr *sa, socklen_t salen,
-    char *host, socklen_t hostlen, char *serv, socklen_t servlen,
-    int flags)
+getnameinfo_link(const struct sockaddr *sa, socklen_t salen, char *host,
+       socklen_t hostlen, char *serv, socklen_t servlen, int flags)
 {
        const struct sockaddr_dl *sdl =
            (const struct sockaddr_dl *)(const void *)sa;
@@ -570,11 +553,7 @@ getnameinfo_link(const struct sockaddr *
 }
 
 static int
-hexname(cp, len, host, hostlen)
-       const u_int8_t *cp;
-       char *host;
-       size_t len;
-       socklen_t hostlen;
+hexname(const u_int8_t *cp, size_t len, char *host, socklen_t hostlen)
 {
        int n;
        size_t i;



Home | Main Index | Thread Index | Old Index