summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/tsearch.3
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/tsearch.3')
-rw-r--r--lib/libc/stdlib/tsearch.320
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/libc/stdlib/tsearch.3 b/lib/libc/stdlib/tsearch.3
index cfe39c2..ac6d841 100644
--- a/lib/libc/stdlib/tsearch.3
+++ b/lib/libc/stdlib/tsearch.3
@@ -55,7 +55,9 @@ from Knuth (6.2.2). The comparison function passed in by
the user has the same style of return values as
.Xr strcmp 3 .
.Pp
-.Fn Tfind
+The
+.Fn tfind
+function
searches for the datum matched by the argument
.Fa key
in the binary tree rooted at
@@ -63,7 +65,9 @@ in the binary tree rooted at
returning a pointer to the datum if it is found and NULL
if it is not.
.Pp
-.Fn Tsearch
+The
+.Fn tsearch
+function
is identical to
.Fn tfind
except that if no match is found,
@@ -72,7 +76,9 @@ is inserted into the tree and a pointer to it is returned. If
.Fa rootp
points to a NULL value a new binary search tree is created.
.Pp
-.Fn Tdelete
+The
+.Fn tdelete
+function
deletes a node from the specified binary search tree and returns
a pointer to the parent of the node to be deleted.
It takes the same arguments as
@@ -83,7 +89,9 @@ If the node to be deleted is the root of the binary search tree,
.Fa rootp
will be adjusted.
.Pp
-.Fn Twalk
+The
+.Fn twalk
+function
walks the binary search tree rooted in
.Fa root
and calls the function
@@ -105,10 +113,12 @@ The
function returns NULL if allocation of a new node fails (usually
due to a lack of free memory).
.Pp
-.Fn Tfind ,
+The
+.Fn tfind ,
.Fn tsearch ,
and
.Fn tdelete
+functions
return NULL if
.Fa rootp
is NULL or the datum cannot be found.
OpenPOWER on IntegriCloud