Mon Feb 14 19:13:04 2022 UTC ()
linux: Don't skip the last node in rbtree iteration.


(riastradh)
diff -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/rbtree.h

cvs diff -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/rbtree.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/linux/rbtree.h 2021/12/19 12:00:08 1.15
+++ src/sys/external/bsd/drm2/include/linux/rbtree.h 2022/02/14 19:13:04 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rbtree.h,v 1.15 2021/12/19 12:00:08 riastradh Exp $ */ 1/* $NetBSD: rbtree.h,v 1.16 2022/02/14 19:13:04 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -142,17 +142,17 @@ rb_replace_node_cached(struct rb_node *o @@ -142,17 +142,17 @@ rb_replace_node_cached(struct rb_node *o
142{ 142{
143 rb_replace_node(old, new, &root->rb_root); 143 rb_replace_node(old, new, &root->rb_root);
144} 144}
145 145
146/* 146/*
147 * XXX This is not actually postorder, but I can't fathom why you would 147 * XXX This is not actually postorder, but I can't fathom why you would
148 * want postorder for an ordered tree; different insertion orders lead 148 * want postorder for an ordered tree; different insertion orders lead
149 * to different traversal orders. 149 * to different traversal orders.
150 */ 150 */
151#define rbtree_postorder_for_each_entry_safe(NODE, TMP, ROOT, FIELD) \ 151#define rbtree_postorder_for_each_entry_safe(NODE, TMP, ROOT, FIELD) \
152 for ((NODE) = RB_TREE_MIN(&(ROOT)->rbr_tree); \ 152 for ((NODE) = RB_TREE_MIN(&(ROOT)->rbr_tree); \
153 ((NODE) != NULL && \ 153 ((NODE) != NULL && \
154 ((TMP) = rb_tree_iterate(&(ROOT)->rbr_tree, (NODE), \ 154 ((TMP) = rb_tree_iterate(&(ROOT)->rbr_tree, (NODE), \
155 RB_DIR_RIGHT))); \ 155 RB_DIR_RIGHT), 1)); \
156 (NODE) = (TMP)) 156 (NODE) = (TMP))
157 157
158#endif /* _LINUX_RBTREE_H_ */ 158#endif /* _LINUX_RBTREE_H_ */