Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Feb 2013 03:08:57 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r246348 - head/sys/fs/ext2fs
Message-ID:  <201302050308.r1538vXY099428@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue Feb  5 03:08:56 2013
New Revision: 246348
URL: http://svnweb.freebsd.org/changeset/base/246348

Log:
  ext2fs: Use nitems().
  
  Submitted by:	Christoph Mallon
  MFC after:	2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_lookup.c

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_lookup.c	Tue Feb  5 03:01:04 2013	(r246347)
+++ head/sys/fs/ext2fs/ext2_lookup.c	Tue Feb  5 03:08:56 2013	(r246348)
@@ -88,9 +88,8 @@ static u_char ext2_ft_to_dt[] = {
 	DT_SOCK,		/* EXT2_FT_SOCK */
 	DT_LNK,			/* EXT2_FT_SYMLINK */
 };
-#define	FTTODT(ft)						\
-    ((ft) > sizeof(ext2_ft_to_dt) / sizeof(ext2_ft_to_dt[0]) ?	\
-    DT_UNKNOWN : ext2_ft_to_dt[(ft)])
+#define	FTTODT(ft) \
+    ((ft) > nitems(ext2_ft_to_dt) ? DT_UNKNOWN : ext2_ft_to_dt[(ft)])
 
 static u_char dt_to_ext2_ft[] = {
 	EXT2_FT_UNKNOWN,	/* DT_UNKNOWN */
@@ -109,9 +108,8 @@ static u_char dt_to_ext2_ft[] = {
 	EXT2_FT_UNKNOWN,	/* unused */
 	EXT2_FT_UNKNOWN,	/* DT_WHT */
 };
-#define	DTTOFT(dt)						\
-    ((dt) > sizeof(dt_to_ext2_ft) / sizeof(dt_to_ext2_ft[0]) ?	\
-    EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)])
+#define	DTTOFT(dt) \
+    ((dt) > nitems(dt_to_ext2_ft) ? EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)])
 
 static int	ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de,
 		    int entryoffsetinblock);



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