From owner-svn-src-head@freebsd.org Fri Mar 10 06:25:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A61E6D050C5; Fri, 10 Mar 2017 06:25:55 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72B2B114E; Fri, 10 Mar 2017 06:25:55 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2A6PsxE087110; Fri, 10 Mar 2017 06:25:54 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2A6PsOS087109; Fri, 10 Mar 2017 06:25:54 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201703100625.v2A6PsOS087109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 10 Mar 2017 06:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314994 - head/usr.sbin/acpi/acpidump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Mar 2017 06:25:55 -0000 Author: araujo Date: Fri Mar 10 06:25:54 2017 New Revision: 314994 URL: https://svnweb.freebsd.org/changeset/base/314994 Log: Use nitems() from sys/param.h. Reviewed by: ngie MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9940 Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Fri Mar 10 06:23:15 2017 (r314993) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Mar 10 06:25:54 2017 (r314994) @@ -420,7 +420,7 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp ACPI_MADT_GENERIC_REDISTRIBUTOR *gicr; ACPI_MADT_GENERIC_TRANSLATOR *gict; - if (mp->Type < sizeof(apic_types) / sizeof(apic_types[0])) + if (mp->Type < nitems(apic_types)) printf("\tType=%s\n", apic_types[mp->Type]); else printf("\tType=%d (unknown)\n", mp->Type); @@ -470,8 +470,7 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp break; case ACPI_MADT_TYPE_INTERRUPT_SOURCE: isrc = (ACPI_MADT_INTERRUPT_SOURCE *)mp; - if (isrc->Type < sizeof(platform_int_types) / - sizeof(platform_int_types[0])) + if (isrc->Type < nitems(platform_int_types)) printf("\tType=%s\n", platform_int_types[isrc->Type]); else printf("\tType=%d (unknown)\n", isrc->Type); @@ -1082,7 +1081,7 @@ acpi_print_srat(ACPI_SUBTABLE_HEADER *sr ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; ACPI_SRAT_GICC_AFFINITY *gic; - if (srat->Type < sizeof(srat_types) / sizeof(srat_types[0])) + if (srat->Type < nitems(srat_types)) printf("\tType=%s\n", srat_types[srat->Type]); else printf("\tType=%d (unknown)\n", srat->Type);