From b81bbb07998dcc210e074cabefbb31087835e06f Mon Sep 17 00:00:00 2001 From: araujo Date: Sat, 30 Jul 2016 06:19:34 +0000 Subject: [PATCH] Use nitems() from sys/param.h. Sponsored by: gandi.net (BSD Day Taiwan) --- sbin/fsdb/fsdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index 1315aeca0acb..b35a06775452 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -898,7 +898,7 @@ CMDFUNCSTART(newtype) return 1; type = DIP(curinode, di_mode) & IFMT; for (tp = typenamemap; - tp < &typenamemap[sizeof(typenamemap)/sizeof(*typenamemap)]; + tp < &typenamemap[nitems(typenamemap)]; tp++) { if (!strcmp(argv[1], tp->typename)) { printf("setting type to %s\n", tp->typename); @@ -906,7 +906,7 @@ CMDFUNCSTART(newtype) break; } } - if (tp == &typenamemap[sizeof(typenamemap)/sizeof(*typenamemap)]) { + if (tp == &typenamemap[nitems(typenamemap)]) { warnx("type `%s' not known", argv[1]); warnx("try one of `file', `dir', `socket', `fifo'"); return 1;