Re: [PATCH (2) 28/34] strptime.3: Use sizeof consistently

Michael Kerrisk (man-pages)
2020-09-04T15:38:00Z

Hi Alex,

On 9/4/20 4:57 PM, Alejandro Colomar wrote:
>>From f000e36d106a22d68f26e9cebe84758854739a42 Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@gmail.com>
> Date: Thu, 3 Sep 2020 21:56:21 +0200
> Subject: [PATCH 28/34] strptime.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>

Patch applied.

Thanks,

Michael

> ---
> man3/strptime.3 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/man3/strptime.3 b/man3/strptime.3
> index d12f298ff..ab7d76f9a 100644
> --- a/man3/strptime.3
> +++ b/man3/strptime.3
> @@ -429,7 +429,7 @@ main(void)
> struct tm tm;
> char buf[255];
>
> - memset(&tm, 0, sizeof(struct tm));
> + memset(&tm, 0, sizeof(tm));
> strptime("2001\-11\-12 18:31:01", "%Y\-%m\-%d %H:%M:%S", &tm);
> strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
> puts(buf);
>

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