Date: Mon, 16 Dec 2024 14:46:13 GMT From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 2110eef4bf60 - main - MAC/do: toast_rules(): Minor simplification Message-ID: <202412161446.4BGEkD2l054169@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=2110eef4bf608b6c1facc57c68d02960b6d880c9 commit 2110eef4bf608b6c1facc57c68d02960b6d880c9 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-08-13 08:53:24 +0000 Commit: Olivier Certner <olce@FreeBSD.org> 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412161446.4BGEkD2l054169>