From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 04:44:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5CD09566; Fri, 21 Dec 2012 04:44:41 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41ACB8FC12; Fri, 21 Dec 2012 04:44:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBL4ifNN090877; Fri, 21 Dec 2012 04:44:41 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBL4if6j090876; Fri, 21 Dec 2012 04:44:41 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201212210444.qBL4if6j090876@svn.freebsd.org> From: Neel Natu Date: Fri, 21 Dec 2012 04:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244530 - head/usr.sbin/mptable X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 04:44:41 -0000 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 +#include #include #include #include @@ -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;