All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: mtk.manpages@gmail.com
Cc: linux-man@vger.kernel.org, jwakely@redhat.com
Subject: Re: [PATCH] getaddrinfo.3: Fix includes
Date: Fri, 14 May 2021 15:21:54 +0200	[thread overview]
Message-ID: <499d96ce-cc52-e463-7bd2-86f7bea7e260@gmail.com> (raw)
In-Reply-To: <20210514131158.16904-1-alx.manpages@gmail.com>

On 5/14/21 3:11 PM, Alejandro Colomar wrote:
> - Remove unnecessary includes
> - Add a comment about why each include is needed
> - Sort alphabetically
> 
> All this has been done using iwyu(1):
> 
> $ iwyu getaddrinfo_server.c 2>&1 \
>    | sed -e '\,^#,s,//,/*,' -e '\,^#,s,$, */,' \
>    | sed '/^#/s/\w*\.\.\./.../';
> 
> getaddrinfo_client.c should add these lines:
> 
> getaddrinfo_client.c should remove these lines:
> - #include <sys/types.h>  // lines 1-1
> 
> The full include-list for getaddrinfo_client.c:
>   #include <netdb.h>       /* for addrinfo, freeaddrinfo, gai_strerror, ... */
>   #include <stdio.h>       /* for fprintf, stderr, perror, printf, NULL, size_t */
>   #include <stdlib.h>      /* for exit, EXIT_FAILURE, EXIT_SUCCESS */
>   #include <string.h>      /* for memset, strlen */
>   #include <sys/socket.h>  /* for connect, socket, AF_UNSPEC, SOCK_DGRAM */
>   #include <unistd.h>      /* for close, read, write, ssize_t */

Oops, the above should be:

getaddrinfo_server.c should add these lines:

getaddrinfo_server.c should remove these lines:
- #include <sys/types.h>  // lines 1-1

The full include-list for getaddrinfo_server.c:
  #include <netdb.h>       /* for addrinfo, gai_strerror, freeaddrinfo, 
... */
  #include <stdio.h>       /* for fprintf, NULL, stderr, printf */
  #include <stdlib.h>      /* for exit, EXIT_FAILURE */
  #include <string.h>      /* for memset */
  #include <sys/socket.h>  /* for bind, recvfrom, sendto, socket, ... */
  #include <unistd.h>      /* for close, ssize_t */


The code contents are correct.

> $ iwyu getaddrinfo_client.c 2>&1 \
>    | sed -e '\,^#,s,//,/*,' -e '\,^#,s,$, */,' \
>    | sed '/^#/s/\w*\.\.\./.../';
> 
> getaddrinfo_client.c should add these lines:
> 
> getaddrinfo_client.c should remove these lines:
> - #include <sys/types.h>  // lines 1-1
> 
> The full include-list for getaddrinfo_client.c:
>   #include <netdb.h>       /* for addrinfo, freeaddrinfo, gai_strerror, ... */
>   #include <stdio.h>       /* for fprintf, stderr, perror, printf, NULL, size_t */
>   #include <stdlib.h>      /* for exit, EXIT_FAILURE, EXIT_SUCCESS */
>   #include <string.h>      /* for memset, strlen */
>   #include <sys/socket.h>  /* for connect, socket, AF_UNSPEC, SOCK_DGRAM */
>   #include <unistd.h>      /* for close, read, write, ssize_t */
> $
> 

-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

  reply	other threads:[~2021-05-14 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 13:11 [PATCH] getaddrinfo.3: Fix includes Alejandro Colomar
2021-05-14 13:21 ` Alejandro Colomar (man-pages) [this message]
2021-05-14 13:26   ` [PATCH v2] " Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=499d96ce-cc52-e463-7bd2-86f7bea7e260@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=jwakely@redhat.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.