答复: 答复: [PATCH] rbtree: stop iteration early in rb_find_first

From: Li,Rongqing
Date: Wed Aug 25 2021 - 14:27:06 EST










 
On Wed, Aug 25, 2021 at 04:01:53PM +0000, Li,Rongqing wrote:
>
> >>
> >>
> >>                         10
> >>                       /
> >>                      5
> >>                       \
> >>                        10

>That again breaks the above case.

10
/
5
\
10

the above case should not exist. like below, when second 10 is inserted, it should be inserted to right leaf
10
/
5

as a result, it should be

10
/ \
5 10

since 10 is not less 10, so new 10 is inserted to right.
and it depends on
bool (*less)(struct rb_node *, const struct rb_node *) which not return true when equal

this case should be ok
10
\
12
/
10

-Li