Date: Fri, 21 Dec 2012 04:44:41 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244530 - head/usr.sbin/mptable Message-ID: <201212210444.qBL4if6j090876@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: neel Date: Fri Dec 21 04:44:40 2012 New Revision: 244530 URL: http://svnweb.freebsd.org/changeset/base/244530 Log: Divine the array size by using 'nitems(array)' instead of using magic numbers. Suggested by: Garrett Cooper Modified: head/usr.sbin/mptable/mptable.c Modified: head/usr.sbin/mptable/mptable.c ============================================================================== --- head/usr.sbin/mptable/mptable.c Fri Dec 21 04:28:05 2012 (r244529) +++ head/usr.sbin/mptable/mptable.c Fri Dec 21 04:44:40 2012 (r244530) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212210444.qBL4if6j090876>