[PATCH (2) 06/34] perf_event_open.2: Use sizeof consistently

Alejandro Colomar
2020-09-04T10:57:41Z

From dbb7b520bd4314488122835c87f45b685ce45b28 Mon Sep 17 00:00:00 2001
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
Date: Thu, 3 Sep 2020 21:29:02 +0200
Subject: [PATCH 06/34] 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 <colomar.6.4.3@gmail.com>
---
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;
--
2.28.0