summaryrefslogtreecommitdiff
path: root/sys/man/2
diff options
context:
space:
mode:
authorspew <devnull@localhost>2017-04-22 13:59:37 -0500
committerspew <devnull@localhost>2017-04-22 13:59:37 -0500
commit9cf519814591413493be10cfaa00853cb15e7a0b (patch)
treec4ad9e0e9ab31887432a8f707ae7c4fcc853c588 /sys/man/2
parentf2b7f24e4e14099251dd0ed8e7e13d7ca466b0cf (diff)
libavl: lookup can return the closest match
Diffstat (limited to 'sys/man/2')
-rw-r--r--sys/man/2/avl14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/man/2/avl b/sys/man/2/avl
index 388b8b3f4..41a4e93ed 100644
--- a/sys/man/2/avl
+++ b/sys/man/2/avl
@@ -30,7 +30,7 @@ struct Avltree {
Avltree *avlcreate(int(*cmp)(Avl*, Avl*));
Avl *avlinsert(Avltree *tree, Avl *new);
Avl *avldelete(Avltree *tree, Avl *key);
-Avl *avllookup(Avltree *tree, Avl *key);
+Avl *avllookup(Avltree *tree, Avl *key, int dir);
Avl *avlnext(Avl *n);
Avl *avlprev(Avl *n);
@@ -55,13 +55,15 @@ node into the tree and returns an existing
node with the same key that has been removed
from the tree and may be freed.
.I Avllookup
-returns the
-node that matches the key or
-.B nil
-if no node matches.
+searches for a given key and returns
+the closest node less than the given key,
+.BR nil ,
+or the closest node greater than the key depending on whether
+.I dir
+is less than, equal to, or greater than zero, respectively.
.I Avldelete
removes the node matching the key from the tree and returns
-it. It returns nil of no matching key is found.
+it. It returns nil if no matching key is found.
.PP
.I Avlnext
returns the next