[PATCH (2) 13/34] cmsg.3: Use sizeof consistently

Alejandro Colomar
2020-09-04T13:57:56Z

From ba70b1e8addad4ef9f2a490d2069b112d09ba9f1 Mon Sep 17 00:00:00 2001
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
Date: Thu, 3 Sep 2020 21:44:41 +0200
Subject: [PATCH 13/34] cmsg.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>
---
man3/cmsg.3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man3/cmsg.3 b/man3/cmsg.3
index 99ee950f9..3d6288901 100644
--- a/man3/cmsg.3
+++ b/man3/cmsg.3
@@ -203,7 +203,7 @@ for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL;
cmsg = CMSG_NXTHDR(&msgh, cmsg)) {
if (cmsg\->cmsg_level == IPPROTO_IP
&& cmsg\->cmsg_type == IP_TTL) {
- memcpy(&receive_ttl, CMSG_DATA(cmsg), sizeof(int));
+ memcpy(&receive_ttl, CMSG_DATA(cmsg), sizeof(received_ttl));
break;
}
}
--
2.28.0