From nobody Tue Sep 2 21:10:51 2025 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 4cGdgw1c3jz65RqT; Tue, 02 Sep 2025 21:10:52 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cGdgw0JzPz426S; Tue, 02 Sep 2025 21:10:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756847452; 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=53jNAHD99KRl0wYXYJ8mgFuOZqlfGHtE5B6f0/Ucgzs=; b=gBk3SwF4rWhd4+LZ/6dlSsOb30LOUjvASj0+7KLBJeaNk1++bZGMjT6vUQS9ziUncSfS3m l713k+vqTkbZK9fFb9ke1Usnh7nu0w7VUWGazWO0xffggwQXZaYlSCbFXgls57rdkDbx6u gwGK8EXif9eDtKeqGqS8WRwh10d6sfbbnaEAvrnmHLJKstx/bbyEJcKuJZMlzejkcSXcQt yMqzeg7p1nK863ZyAj6WzOLtkOicS5jOjCs1gyCmhouOPilWOoPHmxtkIhpnu1TC6ZUxgr rpF/pi8ZOk6DiuGe0pZlzeZXg68r9R85VD1IIivX0R1DIZOdVRqz7Ply2yX9og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756847452; 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=53jNAHD99KRl0wYXYJ8mgFuOZqlfGHtE5B6f0/Ucgzs=; b=SjIkpxZQY0cpPJwe7Zm4JXEpSwuT6DeQOkcMRxOE+oWKitKwuRON6wBMXcmz/e1PesZttC Od3/YWC0nLVtPf8RFonBgxP4BmGl5Xza0axpCfuHpQQDSig5FwHbdxsLOd1y58rpNRPN28 zCq3/r6FcbmmQ4InB8EAu/ik/l+nhNebuCFd7yjteNllaBuNMrbU+5Alo31iHVis4RWkYF d0qJk35bHQNNbEVOcDglrLekLZZqlpzy21JJLt3gP18Hkv3qjkCvlcjYESGGEqJBYihpfy 1g8rOF/3c1kv/XgNcWWOt6abGoI8duphJUm4wrsUfpw1fLWoZ/LR70vp1FeOmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756847452; a=rsa-sha256; cv=none; b=v8mlnxshnzUDgXx5vevrRiuSM22RZhD9GFFAyruxHecm0F7bmYv5tAkvygyAkeFbqC0T4k DFAlwZW8XJ1rMGlNP94jTtgHQXdUzThlxEWgonobCqVSltFadn7Ittu8fagUJ9hcgeNw/B gPGxJQYCdvgO7lE4B4nED5/BDxpkCIOLlDt+XU5hNqXliwRRaqgePdSq8V+8PUb4MeXhGC 1T9+DlK+kXwi4EdyRbCNo8en5XzvEOvJLKFer26rj1ODHM/YP000hVexu5m87J5/6vYixW H9h79CkX2E9wTAxwYeBMkFMN2RKzZ8Apumqr2epFtN6Apcj1FBTJh0KwnL4ATw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cGdgv71gyz130X; Tue, 02 Sep 2025 21:10:51 +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 582LApJ7036409; Tue, 2 Sep 2025 21:10:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 582LApXD036406; Tue, 2 Sep 2025 21:10:51 GMT (envelope-from git) Date: Tue, 2 Sep 2025 21:10:51 GMT Message-Id: <202509022110.582LApXD036406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d64ba46792e7 - main - pfctl: Rewrite some ugly for loops 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d64ba46792e786aecbd9a3d5b0579e1e224a0433 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d64ba46792e786aecbd9a3d5b0579e1e224a0433 commit d64ba46792e786aecbd9a3d5b0579e1e224a0433 Author: Kristof Provost AuthorDate: 2025-08-12 15:34:44 +0000 Commit: Kristof Provost CommitDate: 2025-09-02 21:10:19 +0000 pfctl: Rewrite some ugly for loops This fixes a few KNF issues and ugly line wrapping by using a local version of nitems(); fix two bsearch() on top. ok claudio FreeBSD note: we already used nitems(), but now pick up the use of size_t over unsigned int. Obtained from: OpenBSD, tb , 3d49904c6e Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 3c4f9f6b4334..ce58e0636022 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -242,7 +242,7 @@ copy_satopfaddr(struct pf_addr *pfa, struct sockaddr *sa) const struct icmptypeent * geticmptypebynumber(u_int8_t type, sa_family_t af) { - unsigned int i; + size_t i; if (af != AF_INET6) { for (i=0; i < nitems(icmp_type); i++) { @@ -261,7 +261,7 @@ geticmptypebynumber(u_int8_t type, sa_family_t af) const struct icmptypeent * geticmptypebyname(char *w, sa_family_t af) { - unsigned int i; + size_t i; if (af != AF_INET6) { for (i=0; i < nitems(icmp_type); i++) { @@ -280,7 +280,7 @@ geticmptypebyname(char *w, sa_family_t af) const struct icmpcodeent * geticmpcodebynumber(u_int8_t type, u_int8_t code, sa_family_t af) { - unsigned int i; + size_t i; if (af != AF_INET6) { for (i=0; i < nitems(icmp_code); i++) { @@ -301,7 +301,7 @@ geticmpcodebynumber(u_int8_t type, u_int8_t code, sa_family_t af) const struct icmpcodeent * geticmpcodebyname(u_long type, char *w, sa_family_t af) { - unsigned int i; + size_t i; if (af != AF_INET6) { for (i=0; i < nitems(icmp_code); i++) {