This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch gentoo/2.23 updated. glibc-2.23-30-g98a00b7


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, gentoo/2.23 has been updated
       via  98a00b7f0d6ea6aeeb13fc056409b99e8a3b138d (commit)
      from  bdf954102f10d811fb08bcf8057d49651a5418e4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=98a00b7f0d6ea6aeeb13fc056409b99e8a3b138d

commit 98a00b7f0d6ea6aeeb13fc056409b99e8a3b138d
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed May 4 14:35:12 2016 +0200

    getnameinfo: Reduce line length and add missing comments
    
    (cherry picked from commit c9b0e6a432e827b61f12eb52c2aaeadc77b64461)
    (cherry picked from commit c5aae1035cac6305a111e3461af23a924914d9f5)

diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index ce05dda..c649c49 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -198,10 +198,9 @@ gni_host_inet_name (struct scratch_buffer *tmpbuf,
   struct hostent *h = NULL;
   if (sa->sa_family == AF_INET6)
     {
-      while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr),
-				sizeof(struct in6_addr),
-				AF_INET6, &th,
-				tmpbuf->data, tmpbuf->length,
+      const struct sockaddr_in6 *sin6p = (const struct sockaddr_in6 *) sa;
+      while (__gethostbyaddr_r (&sin6p->sin6_addr, sizeof(struct in6_addr),
+				AF_INET6, &th, tmpbuf->data, tmpbuf->length,
 				&h, &herrno))
 	if (herrno == NETDB_INTERNAL && errno == ERANGE)
 	  {
@@ -216,10 +215,9 @@ gni_host_inet_name (struct scratch_buffer *tmpbuf,
     }
   else
     {
-      while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr),
-				sizeof(struct in_addr),
-				AF_INET, &th,
-				tmpbuf->data, tmpbuf->length,
+      const struct sockaddr_in *sinp = (const struct sockaddr_in *) sa;
+      while (__gethostbyaddr_r (&sinp->sin_addr, sizeof(struct in_addr),
+				AF_INET, &th, tmpbuf->data, tmpbuf->length,
 				&h, &herrno))
 	if (herrno == NETDB_INTERNAL && errno == ERANGE)
 	    {
@@ -308,14 +306,10 @@ gni_host_inet_numeric (struct scratch_buffer *tmpbuf,
   const char *c;
   if (sa->sa_family == AF_INET6)
     {
-      const struct sockaddr_in6 *sin6p;
-      uint32_t scopeid;
-
-      sin6p = (const struct sockaddr_in6 *) sa;
-
+      const struct sockaddr_in6 *sin6p = (const struct sockaddr_in6 *) sa;
       c = inet_ntop (AF_INET6,
 		     (const void *) &sin6p->sin6_addr, host, hostlen);
-      scopeid = sin6p->sin6_scope_id;
+      uint32_t scopeid = sin6p->sin6_scope_id;
       if (scopeid != 0)
 	{
 	  /* Buffer is >= IFNAMSIZ+1.  */
@@ -356,14 +350,16 @@ gni_host_inet_numeric (struct scratch_buffer *tmpbuf,
 	}
     }
   else
-    c = inet_ntop (AF_INET,
-		   (const void *) &(((const struct sockaddr_in *) sa)->sin_addr),
-		   host, hostlen);
+    {
+      const struct sockaddr_in *sinp = (const struct sockaddr_in *) sa;
+      c = inet_ntop (AF_INET, &sinp->sin_addr, host, hostlen);
+    }
   if (c == NULL)
     return EAI_OVERFLOW;
   return 0;
 }
 
+/* Convert AF_INET or AF_INET6 socket address, host part.  */
 static int
 gni_host_inet (struct scratch_buffer *tmpbuf,
 	       const struct sockaddr *sa, socklen_t addrlen,
@@ -384,6 +380,7 @@ gni_host_inet (struct scratch_buffer *tmpbuf,
       (tmpbuf, sa, addrlen, host, hostlen, flags);
 }
 
+/* Convert AF_LOCAL socket address, host part.   */
 static int
 gni_host_local (struct scratch_buffer *tmpbuf,
 		const struct sockaddr *sa, socklen_t addrlen,
@@ -408,6 +405,7 @@ gni_host_local (struct scratch_buffer *tmpbuf,
   return 0;
 }
 
+/* Convert the host part of an AF_LOCAK socket address.   */
 static int
 gni_host (struct scratch_buffer *tmpbuf,
 	  const struct sockaddr *sa, socklen_t addrlen,
@@ -439,11 +437,12 @@ gni_serv_inet (struct scratch_buffer *tmpbuf,
      && sizeof (((struct sockaddr_in) {}).sin_port) == sizeof (in_port_t)
      && sizeof (((struct sockaddr_in6) {}).sin6_port) == sizeof (in_port_t),
      "AF_INET and AF_INET6 port consistency");
+  const struct sockaddr_in *sinp = (const struct sockaddr_in *) sa;
   if (!(flags & NI_NUMERICSERV))
     {
       struct servent *s, ts;
       int e;
-      while ((e = __getservbyport_r (((const struct sockaddr_in *) sa)->sin_port,
+      while ((e = __getservbyport_r (sinp->sin_port,
 				     ((flags & NI_DGRAM)
 				      ? "udp" : "tcp"), &ts,
 				     tmpbuf->data, tmpbuf->length, &s)))
@@ -463,9 +462,7 @@ gni_serv_inet (struct scratch_buffer *tmpbuf,
 	}
       /* Fall through to numeric conversion.  */
     }
-  if (__snprintf (serv, servlen, "%d",
-		  ntohs (((const struct sockaddr_in *) sa)->sin_port))
-      + 1 > servlen)
+  if (__snprintf (serv, servlen, "%d", ntohs (sinp->sin_port)) + 1 > servlen)
       return EAI_OVERFLOW;
   return 0;
 }

-----------------------------------------------------------------------

Summary of changes:
 inet/getnameinfo.c |   39 ++++++++++++++++++---------------------
 1 files changed, 18 insertions(+), 21 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]