Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jun 2012 19:59:02 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r236632 - in stable/8/sys: dev/iwn sys
Message-ID:  <201206051959.q55Jx2jT040733@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Tue Jun  5 19:59:02 2012
New Revision: 236632
URL: http://svn.freebsd.org/changeset/base/236632

Log:
  MFC: r236486
  
  Add nitems(), a macro for determining the number of elements in a
  statically-allocated array.
  
  Obtained from:	OpenBSD (in principle)
  
  MFC: r236489

Modified:
  stable/8/sys/dev/iwn/if_iwn.c
  stable/8/sys/sys/param.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/dev/iwn/if_iwn.c
==============================================================================
--- stable/8/sys/dev/iwn/if_iwn.c	Tue Jun  5 19:58:58 2012	(r236631)
+++ stable/8/sys/dev/iwn/if_iwn.c	Tue Jun  5 19:59:02 2012	(r236632)
@@ -2010,8 +2010,6 @@ iwn_setregdomain(struct ieee80211com *ic
 	return 0;
 }
 
-#define nitems(_a)	(sizeof((_a)) / sizeof((_a)[0]))
-
 static void
 iwn_read_eeprom_enhinfo(struct iwn_softc *sc)
 {

Modified: stable/8/sys/sys/param.h
==============================================================================
--- stable/8/sys/sys/param.h	Tue Jun  5 19:58:58 2012	(r236631)
+++ stable/8/sys/sys/param.h	Tue Jun  5 19:59:02 2012	(r236632)
@@ -271,6 +271,7 @@
 #ifndef howmany
 #define	howmany(x, y)	(((x)+((y)-1))/(y))
 #endif
+#define	nitems(x)	(sizeof((x)) / sizeof((x)[0]))
 #define	rounddown(x, y)	(((x)/(y))*(y))
 #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))  /* to any y */
 #define	roundup2(x, y)	(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */



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