From 3376a638383c1290c6169de294176927b200d89a Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 3 Sep 2020 21:29:02 +0200 Subject: [PATCH] perf_event_open.2: 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 --- man2/perf_event_open.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man2/perf_event_open.2 b/man2/perf_event_open.2 index 2492fc75a..ea5ee725f 100644 --- a/man2/perf_event_open.2 +++ b/man2/perf_event_open.2 @@ -3419,9 +3419,9 @@ main(int argc, char **argv) long long count; int fd; - memset(&pe, 0, sizeof(struct perf_event_attr)); + memset(&pe, 0, sizeof(pe)); pe.type = PERF_TYPE_HARDWARE; - pe.size = sizeof(struct perf_event_attr); + pe.size = sizeof(pe); pe.config = PERF_COUNT_HW_INSTRUCTIONS; pe.disabled = 1; pe.exclude_kernel = 1;