From nobody Mon Apr 29 04:27:30 2024 X-Original-To: dev-commits-src-all@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 4VSVfq2sspz5JBnB; Mon, 29 Apr 2024 04:27:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VSVfq0cHWz41W9; Mon, 29 Apr 2024 04:27:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714364851; 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=YlIb79QTU4HZ3oybrh25hEslEMdgR2cUFhXYGZ2QdMc=; b=h2TBzUMIYQPj4JwVw/K1GjLisV0/5MvrwK84/clCDcE1Wovkg++N8WbooomW07AMhepeCH fRxG27vdnVpArz7Cac6tq9ON0dTAS8ABGOLCQOjilOJIW8UVWyMtGMrbwhmOC7kQzyP2pi 0KUL2z3Ex5gfyv7Qwy8Akv6K+O5Xacchk1VR7reztA1ncZok05xMYmgwplT87FekiX0RVt /sgZr6a7s+PRLxM06DM2zyaPBxCtTjqd4ApYHGss9/I0zb2BhZZYx1JA1CCcneUEzgSYgj 0SVBh6jsCY0vg8/TbXn8fvJLEQCSsdHgqknc42zaPLFkdU+6K7JuGOT2lIFQnQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714364851; a=rsa-sha256; cv=none; b=Nkymdi19AEMaHzY5087jfIBn4RY9CqtY7zddc5l7kcMthS7pcJV/s33aZdJAntdZX70jPj av9Ov2e+tfl1Jb78XRYcyYTudRWN5YjeaQ5hiv1gQufVa4Anr68rQ7j/ksr0SCzYAfomhc zqH4HKRqyCKWBshHYmmEYhfhZH3xThxmKHInmEiAlZ9eRelDF4j+Sef5Z2Yai7vke+byee bru5aM4Qpp39PqS/gUY3y4Nf+Svt5Q3ubLOB6/8whZcoLubr01jGcKCUgICtoiwxDizEmK 81wlgodFm+DNH4x/RnmD4G5fWoSCJfwQIkG3XmLohan0gpBm7bCAqlc0fYtv9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714364851; 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=YlIb79QTU4HZ3oybrh25hEslEMdgR2cUFhXYGZ2QdMc=; b=qHp4CveJmgTY/xF0oaX6VuPtaAzDloSMl+KAXmpOXymfifNaRQ1rNQ+7EOG8LzQ14Cw+GE dG4GSshBbH2pFuSheP8TEVPC+bRY3CMX6AfeKzpH+kbk9oy1yrA9+JNP+SATCxDtZJUzO5 7jxMJS++jaDy2S0Yj7zHZz+F5l/ZeG9QQbXhzojZPZDdXoqSuY37ZZ5biBxZ28c4XaI/TG SccH86EoUoL3nfkkSdN6TkVONZ7X3J+inN94hGIDq0CsUvm9mF1behyyvkKRS+w1xpJ9e+ CiTE/vdNbrLwHokUZNr4G71Y7osn+C6wAX1gFmqE5HwD0Fu1+wdSJq3omYN7Dg== 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 4VSVfq02WHzvGg; Mon, 29 Apr 2024 04:27:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43T4RUH4045239; Mon, 29 Apr 2024 04:27:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43T4RUvB045236; Mon, 29 Apr 2024 04:27:30 GMT (envelope-from git) Date: Mon, 29 Apr 2024 04:27:30 GMT Message-Id: <202404290427.43T4RUvB045236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 70fad8acae73 - main - ipf: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0]) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70fad8acae7324525df09b46e3ee2007f3ecf0fe Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=70fad8acae7324525df09b46e3ee2007f3ecf0fe commit 70fad8acae7324525df09b46e3ee2007f3ecf0fe Author: Elyes Haouas AuthorDate: 2023-11-07 17:38:03 +0000 Commit: Warner Losh CommitDate: 2024-04-29 04:21:09 +0000 ipf: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0]) Pull Request: https://github.com/freebsd/freebsd-src/pull/888 Signed-off-by: Elyes Haouas --- sbin/ipf/common/lexer.c | 5 +++-- sbin/ipf/libipf/facpri.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sbin/ipf/common/lexer.c b/sbin/ipf/common/lexer.c index 5a898c72032d..d1980765ef93 100644 --- a/sbin/ipf/common/lexer.c +++ b/sbin/ipf/common/lexer.c @@ -10,6 +10,7 @@ # include "netinet/ip_scan.h" #endif #include +#include #include #ifdef TEST_LEXER # define NO_YACC @@ -675,7 +676,7 @@ yysetfixeddict(wordtab_t *newdict) if (yydebug) printf("yysetfixeddict(%lx)\n", (u_long)newdict); - if (yysavedepth == sizeof(yysavewords)/sizeof(yysavewords[0])) { + if (yysavedepth == nitems(yysavewords)) { fprintf(stderr, "%d: at maximum dictionary depth\n", yylineNum); return; @@ -694,7 +695,7 @@ yysetdict(wordtab_t *newdict) if (yydebug) printf("yysetdict(%lx)\n", (u_long)newdict); - if (yysavedepth == sizeof(yysavewords)/sizeof(yysavewords[0])) { + if (yysavedepth == nitems(yysavewords)) { fprintf(stderr, "%d: at maximum dictionary depth\n", yylineNum); return; diff --git a/sbin/ipf/libipf/facpri.c b/sbin/ipf/libipf/facpri.c index 9f66cedc7df5..9325a03c8dc3 100644 --- a/sbin/ipf/libipf/facpri.c +++ b/sbin/ipf/libipf/facpri.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #if !defined(__SVR4) && !defined(__svr4__) #include #endif @@ -76,7 +76,7 @@ fac_toname(int facpri) fac = facpri & LOG_FACMASK; j = fac >> 3; - if (j < (sizeof(facs)/sizeof(facs[0]))) { + if (j < nitems(facs)) { if (facs[j].value == fac) return (facs[j].name); }