]> code.delx.au - gnu-emacs/commitdiff
Port to --enable-gcc-warnings sans getaddrinfo_a
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 23 Feb 2016 23:25:43 +0000 (15:25 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 23 Feb 2016 23:26:23 +0000 (15:26 -0800)
* src/process.c (Fmake_network_process): Add ATTRIBUTE_UNUSED
to a local unused when getaddrinfo_a is missing.
Resize portbuf to size needed.  Do cheap test first.
Move local to block where it’s needed.

src/process.c

index 41e821e145dd0fcca71857ed997198deecde3173..b8e1973601bee6de2d72750890caea21e9408093 100644 (file)
@@ -3600,8 +3600,8 @@ usage: (make-network-process &rest ARGS)  */)
   struct Lisp_Process *p;
 #if defined HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A
   const char *portstring;
-  ptrdiff_t portstringlen;
-  char portbuf[128];
+  ptrdiff_t portstringlen ATTRIBUTE_UNUSED;
+  char portbuf[INT_BUFSIZE_BOUND (EMACS_INT)];
 #endif
 #ifdef HAVE_LOCAL_SOCKETS
   struct sockaddr_un address_un;
@@ -3770,7 +3770,7 @@ usage: (make-network-process &rest ARGS)  */)
 #endif
 
 #ifdef HAVE_GETADDRINFO_A
-  if (!NILP (Fplist_get (contact, QCnowait)) && !NILP (host))
+  if (!NILP (host) && !NILP (Fplist_get (contact, QCnowait)))
     {
       ptrdiff_t hostlen = SBYTES (host);
       struct req
@@ -4897,7 +4897,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 
 #if defined HAVE_GETADDRINFO_A || defined HAVE_GNUTLS
       {
-       Lisp_Object ip_addresses;
        Lisp_Object process_list_head, aproc;
        struct Lisp_Process *p;
 
@@ -4911,7 +4910,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
                /* Check for pending DNS requests. */
                if (p->dns_request)
                  {
-                   ip_addresses = check_for_dns (aproc);
+                   Lisp_Object ip_addresses = check_for_dns (aproc);
                    if (!NILP (ip_addresses) && !EQ (ip_addresses, Qt))
                      connect_network_socket (aproc, ip_addresses);
                  }