summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2013-02-05 03:08:56 +0000
committerpfg <pfg@FreeBSD.org>2013-02-05 03:08:56 +0000
commitc181635a65f2aac53f06c8553fa9b67317362cf0 (patch)
tree598ffb20251011b130400db756e39657b8623350
parentaffc90ea665a0feb83f94f917607b09e1f6e7715 (diff)
downloadFreeBSD-src-c181635a65f2aac53f06c8553fa9b67317362cf0.zip
FreeBSD-src-c181635a65f2aac53f06c8553fa9b67317362cf0.tar.gz
ext2fs: Use nitems().
Submitted by: Christoph Mallon MFC after: 2 weeks
-rw-r--r--sys/fs/ext2fs/ext2_lookup.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c
index 9aadb6a..edd5704 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);
OpenPOWER on IntegriCloud