Re: [PATCH (2) 15/34] getaddrinfo.3: Use sizeof consistently

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

 



Hi Alex,

On 9/4/20 3:53 PM, Alejandro Colomar wrote:
>>From eef612c1f5f039421bd0fa167e1972e98d934bce Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
> Date: Thu, 3 Sep 2020 21:46:06 +0200
> Subject: [PATCH 15/34] 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@xxxxxxxxx>

Patch applied.

Cheers,

Michael

> ---
>  man3/getaddrinfo.3 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/man3/getaddrinfo.3 b/man3/getaddrinfo.3
> index 8aa544789..158fd2e31 100644
> --- a/man3/getaddrinfo.3
> +++ b/man3/getaddrinfo.3
> @@ -679,7 +679,7 @@ main(int argc, char *argv[])
>          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_socktype = SOCK_DGRAM; /* Datagram socket */
>      hints.ai_flags = AI_PASSIVE;    /* For wildcard IP address */
> @@ -775,7 +775,7 @@ main(int argc, char *argv[])
> 
>      /* 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_socktype = SOCK_DGRAM; /* Datagram socket */
>      hints.ai_flags = 0;
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux