aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2023-11-07 17:13:32 +0000
committerWarner Losh <imp@FreeBSD.org>2024-04-29 03:30:55 +0000
commitf93475cf0fd8a7992131a5b8c7f94372a3e44f9c (patch)
treea00ea9d439b6533af49bbe59d1205dc85b3c924d
parent67db7b43d07e9b29564f6b4734f8d2e975cc805c (diff)
downloadsrc-f93475cf0fd8a7992131a5b8c7f94372a3e44f9c.tar.gz
src-f93475cf0fd8a7992131a5b8c7f94372a3e44f9c.zip
pstat: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888 Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
-rw-r--r--usr.sbin/pstat/pstat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index aab7e902cc4c..fd11c7666955 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -388,7 +388,7 @@ filemode(void)
printf(sizeof(uintptr_t) == 4 ? fhdr32 : fhdr64);
wid = (int)sizeof(uintptr_t) * 2;
for (fp = (struct xfile *)buf, i = 0; i < openf; ++fp, ++i) {
- if ((size_t)fp->xf_type >= sizeof(dtypes) / sizeof(dtypes[0]))
+ if ((size_t)fp->xf_type >= nitems(dtypes))
continue;
(void)printf("%*jx", wid, (uintmax_t)(uintptr_t)fp->xf_file);
(void)printf(" %-6.6s", dtypes[fp->xf_type]);