From nobody Sat Oct 19 14:34:41 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XW3xY5qKbz5b8sv; Sat, 19 Oct 2024 14:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XW3xY2fJwz4YPx; Sat, 19 Oct 2024 14:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729348481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xjhoSWrUiP36sR4EpYltGNQjbbYPTkVk/Po+nk+Ye9Q=; b=vvQ0tIrEU6SoiipjNqzgSbS4nS6GEmymg3/tvE4iodDQ5a0bTXwYAB4WXMz1oWY+4fhg5H oJyzW0C5tgMkq1YoyaojyAThjB3QO2HzZCSkVy3QnYUFSNqj4hcwHNlvon/diu109aGdS7 WZ2fSJLcK7vDVPq9+t+sEbC9GrxfJBQBMnKKqqkgeyOFrVEaMtAIlXP/tOn3hUY74bNM1Q n+P6vzVlDTG2A6KVe9ON9WhsITJeuSUHrbYoSiOz8hbz524PAFJLgYsia7CotMqscY+9+l tKzUsOcL86Ikk3ZT8UBQKP2r1jUOHQulG200/WbuV8jdDOb3J9axwN67KoBlLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729348481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xjhoSWrUiP36sR4EpYltGNQjbbYPTkVk/Po+nk+Ye9Q=; b=tFX3BOkWCNpZ/f5hS3D3Ut1vD3zd7LD9BiIK0/mURv/J5vbpgBIYVybS42baALCTh6ozax hDYcp5bQXnX4OdEvY4lRBUTudKWi9Hty0WlXbkAO3cE2dsiCLq5dTpuOSd+gbDRuOrVF6S muUCKYbRXhnoCFZmbsvwgQ2NYEojENS60z5TDsLVGAKs4rxgLlmsIG1Ek2cGwXytAWzc2t qeOhPlPdlGMHXy254cY3ZunTocCHLLsTZyJCELtpe/zgcWZW2AIQDY+nEk97Lp/+/XzxD7 bHIsviegkykPrekaI3wXw04BoaBeECRdmRNd/8huRJuuRmO9l1Y5EJ/gubIQnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729348481; a=rsa-sha256; cv=none; b=M3qq9IHY3gV8HmEwtr2qP52ot9vCJ9CptZYWsFjlQpFBFhzUiSks/eiYCr2vVb5S1st15K sVXyl2AlES9CwjOiY3UFweP3V9zpsyZSml+VgtKi0n/X7JiOY7pqqWONhv3AgH6U9l56eb e4Wydzy+QBlfUMdix7wUPrRTpdeVffQ4nS4tG0XR7se7Yf8monFbeuMPq97PSN6+9medsQ P6FDSZXJoslTgYkeapErSLUfDG5lomrp2vWdGW1ulqhiveHA/PedwACnv8FVjXE/Ji4Vo7 /Kjf+X21XUFF0u87S0kMbsFVQshQ9gPtoQJbiGfcoK8dHl50Lln2ZWcUWNRg/A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XW3xY22ZhzM7N; Sat, 19 Oct 2024 14:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49JEYfMR049525; Sat, 19 Oct 2024 14:34:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49JEYffj049522; Sat, 19 Oct 2024 14:34:41 GMT (envelope-from git) Date: Sat, 19 Oct 2024 14:34:41 GMT Message-Id: <202410191434.49JEYffj049522@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 53314e34d5e8 - main - mididump(1): Use nitems() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53314e34d5e8e7f781ab990805b22f7a56bc0580 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=53314e34d5e8e7f781ab990805b22f7a56bc0580 commit 53314e34d5e8e7f781ab990805b22f7a56bc0580 Author: Christos Margiolis AuthorDate: 2024-10-19 14:34:27 +0000 Commit: Christos Margiolis CommitDate: 2024-10-19 14:34:27 +0000 mididump(1): Use nitems() Reported by: kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D47191 --- usr.bin/mididump/mididump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/mididump/mididump.c b/usr.bin/mididump/mididump.c index 16bd775f10d4..8ebcce547ac4 100644 --- a/usr.bin/mididump/mididump.c +++ b/usr.bin/mididump/mididump.c @@ -28,6 +28,7 @@ * SUCH DAMAGE. */ +#include #include #include @@ -39,7 +40,6 @@ #include #include -#define ARRLEN(x) (sizeof(x) / sizeof(x[0])) #define NOTE2OCTAVE(n) (n / 12 - 1) #define NOTE2FREQ(n) (440 * pow(2.0f, ((float)n - 69) / 12)) #define CHAN_MASK 0x0f @@ -189,7 +189,7 @@ main(int argc, char *argv[]) case 0x90 ... 0x9f: b1 = read_byte(fd); b2 = read_byte(fd); - pn = ¬es[b1 % ARRLEN(notes)]; + pn = ¬es[b1 % nitems(notes)]; snprintf(buf, sizeof(buf), "%s%d", pn->name, NOTE2OCTAVE(b1)); if (pn->alt != NULL) { @@ -211,7 +211,7 @@ main(int argc, char *argv[]) case 0xb0 ... 0xbf: b1 = read_byte(fd); b2 = read_byte(fd); - if (b1 > ARRLEN(ctls) - 1) + if (b1 > nitems(ctls) - 1) break; printf("Control/Mode change channel=%d, " "control=%d (%s), value=%d",