From nobody Mon Dec 16 14:46:13 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 4YBjS55gt1z5hWXg; Mon, 16 Dec 2024 14:46:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YBjS54RW3z4fSf; Mon, 16 Dec 2024 14:46:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734360373; 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=u8As7EZCZxDArVvF4/l3+ducU1kEfX6TCli6EFBEsF8=; b=ealrzlfDpp67EH+cz6QibgLfGck4k7pJWQtPJ86He8K/IgYeSG1aV9vpj6Hn3mXyrrAiR4 ZfMg7O80qKRxfl1XwZXi4wTDBNttJUHQLhz+rAUZCVPQ3Rl40ptfdFbarXvtSJxIgURMIA t/mgpWc1h+j3yt+4v9cMf2vL4h4lpgF2Ef7C11uFckxkoV0dLVRWBV9MHYQ+k/APohoK6o aahLYjwkZwMeWZpc22o/qgvsHc1FDj1F3c2Uijfco4W8so6sgXkNSRuwWXtE8gfmC85mkU q6kdm2xXPOp3uTjdXEy+nmYkJ7DMUmHuHFqyCBXmKTd5/gM6Dz9xmELz4UmaXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734360373; 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=u8As7EZCZxDArVvF4/l3+ducU1kEfX6TCli6EFBEsF8=; b=yINskam2/ZWG6EYPEPYrbsIrCpJ46uBvC2vjJ9D98EpaeEGiI2PgFWUbIu5CkxoJFJNpSw MbUWTJhsCWuzVywFSrmm28o/+4GWIxo4mLtYT97ygbkWJrkIKQXoyN27AREMRPjVvkQC7C eNlWNS8tYJ+Ew4Z0hr9UQXaACosQFtvrZxZID8klrO2FVQp3dV3k35FARtNBm4ZeqqXKXD +WwJIp6sQ19YxOfkvPsIyCHr8I1iHsmwt+LdVkEjFyA4J4BNtL7AurxC8YIpUDFego0QKA +BBqqVMZD2Mr6MUVbc5QFvu3zFhGzGDf0mqMdMQO0AiCKpP7tv/ZbpM3GvaRpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734360373; a=rsa-sha256; cv=none; b=hPsf+cnGxix3nLLPoO00WRu6fJDL6Ap+Em5MN4O2F/vXWy/D1KIjO4aDGX8q8QA3D8J+UL FiUhvnl5hZah8cI0vrd1bMyu6IK4Gt+6QaUT1ylaI+nbSZTESpi9Wkf5U36O7aWy6zKnPw zyg/j4x3LqqRpVo8XtCeaO97J12a0ODr3M1hOIcH+ay+Z47SIzuFI9ILiOtJBHgBXjQrMq iZwZTDp/+SJKVzgEmMEWVyg9b+n0J93Qf0U+Vioj9yRk/SZTjMXIJ8LoEuA62E+MRX+YWE dJ3e0jPji5NOicBz3M164E9NHRoa9r+dzAXqCSj/fn6C7X0TRrui5AldlJNRvQ== 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 4YBjS54234zxHC; Mon, 16 Dec 2024 14:46:13 +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 4BGEkDAM054172; Mon, 16 Dec 2024 14:46:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BGEkD2l054169; Mon, 16 Dec 2024 14:46:13 GMT (envelope-from git) Date: Mon, 16 Dec 2024 14:46:13 GMT Message-Id: <202412161446.4BGEkD2l054169@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 2110eef4bf60 - main - MAC/do: toast_rules(): Minor simplification 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2110eef4bf608b6c1facc57c68d02960b6d880c9 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=2110eef4bf608b6c1facc57c68d02960b6d880c9 commit 2110eef4bf608b6c1facc57c68d02960b6d880c9 Author: Olivier Certner AuthorDate: 2024-08-13 08:53:24 +0000 Commit: Olivier Certner CommitDate: 2024-12-16 14:42:40 +0000 MAC/do: toast_rules(): Minor simplification Use the most common pattern to browse and delete elements of a list, as it reads quicker. Reviewed by: bapt Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47622 --- sys/security/mac_do/mac_do.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 2ce608c754bc..dc5933930a41 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -311,10 +311,9 @@ static void toast_rules(struct rules *const rules) { struct rulehead *const head = &rules->head; - struct rule *rule; + struct rule *rule, *rule_next; - while ((rule = TAILQ_FIRST(head)) != NULL) { - TAILQ_REMOVE(head, rule, r_entries); + TAILQ_FOREACH_SAFE(rule, head, r_entries, rule_next) { free(rule->uids, M_DO); free(rule->gids, M_DO); free(rule, M_DO);