Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jul 2016 06:19:34 +0000 (UTC)
From:      Marcelo Araujo <araujo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303539 - head/sbin/fsdb
Message-ID:  <201607300619.u6U6JYTY076614@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: araujo
Date: Sat Jul 30 06:19:34 2016
New Revision: 303539
URL: https://svnweb.freebsd.org/changeset/base/303539

Log:
  Use nitems() from sys/param.h.
  
  Sponsored by:	gandi.net (BSD Day Taiwan)

Modified:
  head/sbin/fsdb/fsdb.c

Modified: head/sbin/fsdb/fsdb.c
==============================================================================
--- head/sbin/fsdb/fsdb.c	Sat Jul 30 04:40:44 2016	(r303538)
+++ head/sbin/fsdb/fsdb.c	Sat Jul 30 06:19:34 2016	(r303539)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607300619.u6U6JYTY076614>