mirror of https://github.com/mkerrisk/man-pages
getaddrinfo.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following way: - Use the name of the variable instead of its type as argument for ``sizeof``. Rationale: https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
d5307ece21
commit
8e4dfb59d7
|
@ -679,7 +679,7 @@ main(int argc, char *argv[])
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(struct addrinfo));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
|
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
|
||||||
hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
|
hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
|
||||||
hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
|
hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
|
||||||
|
@ -775,7 +775,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Obtain address(es) matching host/port */
|
/* Obtain address(es) matching host/port */
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(struct addrinfo));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
|
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
|
||||||
hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
|
hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
|
||||||
hints.ai_flags = 0;
|
hints.ai_flags = 0;
|
||||||
|
|
Loading…
Reference in New Issue