summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mptable
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-12-21 04:44:40 +0000
committerneel <neel@FreeBSD.org>2012-12-21 04:44:40 +0000
commit13949c50fa4ff569fa99e6b92485032c35a90594 (patch)
tree87492fdd6fdc290239aa7dca1366c8c91a539223 /usr.sbin/mptable
parent22f1e99a6dde3a2a0c39cf893ada426cdc5e86db (diff)
downloadFreeBSD-src-13949c50fa4ff569fa99e6b92485032c35a90594.zip
FreeBSD-src-13949c50fa4ff569fa99e6b92485032c35a90594.tar.gz
Divine the array size by using 'nitems(array)' instead of using magic numbers.
Suggested by: Garrett Cooper
Diffstat (limited to 'usr.sbin/mptable')
-rw-r--r--usr.sbin/mptable/mptable.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/mptable/mptable.c b/usr.sbin/mptable/mptable.c
index dee8449..01fa897 100644
--- a/usr.sbin/mptable/mptable.c
+++ b/usr.sbin/mptable/mptable.c
@@ -42,7 +42,7 @@ static const char rcsid[] =
#define EXTENDED_PROCESSING_READY
#define OEM_PROCESSING_READY_NOT
-#include <sys/types.h>
+#include <sys/param.h>
#include <err.h>
#include <fcntl.h>
#include <paths.h>
@@ -710,10 +710,12 @@ MPConfigTableHeader( u_int32_t pap )
printf( "MP Config Base Table Entries:\n\n" );
- /* initialze tables */
- for ( x = 0; x < 256; ++x ) {
- busses[ x ] = apics[ x ] = 0xff;
- }
+ /* initialize tables */
+ for (x = 0; x < (int)nitems(busses); x++)
+ busses[x] = 0xff;
+
+ for (x = 0; x < (int)nitems(apics); x++)
+ apics[x] = 0xff;
ncpu = 0;
nbus = 0;
OpenPOWER on IntegriCloud