From: Alejandro Colomar Date: Thu, 3 Sep 2020 19:43:23 +0000 (+0200) Subject: bsearch.3: Use sizeof consistently X-Git-Tag: man-pages-5.09~464 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ec19d12403d9f6d970951e9259519f136ff962e;p=thirdparty%2Fman-pages.git 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 Signed-off-by: Michael Kerrisk --- diff --git a/man3/bsearch.3 b/man3/bsearch.3 index 88e0e6ea17..6859bdba22 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