tree.3: explain RB_FIND() and RB_NFIND()
In collaboration with: dougm Reviewed by: alc Sponsored by: The FreeBSD Foundation (kib) MFC after: 3 days Differential revision: https://reviews.freebsd.org/D36001
This commit is contained in:
parent
624e5dc0ec
commit
08349b18ea
@ -523,10 +523,25 @@ The
|
|||||||
and
|
and
|
||||||
.Fn RB_NFIND
|
.Fn RB_NFIND
|
||||||
macros can be used to find a particular element in the tree.
|
macros can be used to find a particular element in the tree.
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
|
.Fn RB_FIND
|
||||||
|
macro returns the element in the tree equal to the provided
|
||||||
|
key, or
|
||||||
|
.Dv NULL
|
||||||
|
if there is no such element.
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
|
.Fn RB_NFIND
|
||||||
|
macro returns the least element greater than or equal to the provided
|
||||||
|
key, or
|
||||||
|
.Dv NULL
|
||||||
|
if there is no such element.
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
struct TYPE find, *res;
|
struct TYPE find, *res, *resn;
|
||||||
find.key = 30;
|
find.key = 30;
|
||||||
res = RB_FIND(NAME, head, &find);
|
res = RB_FIND(NAME, head, &find);
|
||||||
|
resn = RB_NFIND(NAME, head, &find);
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
|
Loading…
Reference in New Issue
Block a user