[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200910211344.3562-15-colomar.6.4.3@gmail.com>
Date: Thu, 10 Sep 2020 23:13:35 +0200
From: Alejandro Colomar <colomar.6.4.3@...il.com>
To: mtk.manpages@...il.com
Cc: linux-man@...r.kernel.org, linux-kernel@...r.kernel.org,
Alejandro Colomar <colomar.6.4.3@...il.com>
Subject: [PATCH 14/24] fread.3: Move ARRAY_SIZE logic into macro
Signed-off-by: Alejandro Colomar <colomar.6.4.3@...il.com>
---
man3/fread.3 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/man3/fread.3 b/man3/fread.3
index 4c5dc3dbc..8e71e620e 100644
--- a/man3/fread.3
+++ b/man3/fread.3
@@ -136,6 +136,8 @@ Class: 0x02
#include <stdio.h>
#include <stdlib.h>
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
int
main(void)
{
@@ -147,9 +149,7 @@ main(void)
unsigned char buffer[4];
- size_t ret =
- fread(buffer, sizeof(buffer) / sizeof(*buffer), sizeof(*buffer),
- fp);
+ size_t ret = fread(buffer, ARRAY_SIZE(buffer), sizeof(*buffer), fp);
if (ret != sizeof(*buffer)) {
fprintf(stderr, "fread() failed: %zu\en", ret);
exit(EXIT_FAILURE);
--
2.28.0
Powered by blists - more mailing lists