Re: [PATCH (2) 12/34] bsearch.3: Use sizeof consistently

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

 



Hello Alex,

On 9/4/20 3:46 PM, Alejandro Colomar wrote:
>>From 886db3bad74f35fc40a1238a0d2f35ace3dc7620 Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
> Date: Thu, 3 Sep 2020 21:43:23 +0200
> Subject: [PATCH 12/34] bsearch.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. Thanks!

Cheers,

Michael

> ---
>  man3/bsearch.3 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/man3/bsearch.3 b/man3/bsearch.3
> index 88e0e6ea1..6859bdba2 100644
> --- a/man3/bsearch.3
> +++ b/man3/bsearch.3
> @@ -124,12 +124,12 @@ main(int argc, char **argv)
>  {
>      int i;
> 
> -    qsort(months, nr_of_months, sizeof(struct mi), compmi);
> +    qsort(months, nr_of_months, sizeof(months[0]), compmi);
>      for (i = 1; i < argc; i++) {
>          struct mi key, *res;
>          key.name = argv[i];
>          res = bsearch(&key, months, nr_of_months,
> -                      sizeof(struct mi), compmi);
> +                      sizeof(months[0]), compmi);
>          if (res == NULL)
>              printf("\(aq%s\(aq: unknown month\en", argv[i]);
>          else
> 


-- 
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