From 666116e4a3afaea9b4272650440a5095faf2ae5a Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Tue, 5 Feb 2013 03:08:56 +0000 Subject: [PATCH] ext2fs: Use nitems(). Submitted by: Christoph Mallon MFC after: 2 weeks --- sys/fs/ext2fs/ext2_lookup.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c index 9aadb6a47d3b..edd57049db4a 100644 --- a/sys/fs/ext2fs/ext2_lookup.c +++ b/sys/fs/ext2fs/ext2_lookup.c @@ -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);