summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorguenther <>2012-07-08 10:14:35 +0000
committerguenther <>2012-07-08 10:14:35 +0000
commit34dd7f38ef26cac3e96d931dccf15e449563463d (patch)
tree66d837d0800e5f17c05c617535bd25fc3ffa816c /src
parent995c38cd464be88005853d62d9c8ac2d96f6dfe1 (diff)
downloadopenbsd-34dd7f38ef26cac3e96d931dccf15e449563463d.tar.gz
openbsd-34dd7f38ef26cac3e96d931dccf15e449563463d.tar.bz2
openbsd-34dd7f38ef26cac3e96d931dccf15e449563463d.zip
Describe tdelete()'s return value correctly and update the related CAVEAT
Based on a note from Steffen Daode Nurpmeso (sdaoden at googlemail.com) ok jmc@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/stdlib/tsearch.327
1 files changed, 15 insertions, 12 deletions
diff --git a/src/lib/libc/stdlib/tsearch.3 b/src/lib/libc/stdlib/tsearch.3
index 0a52822620..03c9102791 100644
--- a/src/lib/libc/stdlib/tsearch.3
+++ b/src/lib/libc/stdlib/tsearch.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tsearch.3,v 1.16 2007/05/31 19:19:32 jmc Exp $ 1.\" $OpenBSD: tsearch.3,v 1.17 2012/07/08 10:14:35 guenther Exp $
2.\" 2.\"
3.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> 3.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: May 31 2007 $ 17.Dd $Mdocdate: July 8 2012 $
18.Dt TSEARCH 3 18.Dt TSEARCH 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -68,13 +68,13 @@ points to a null value a new binary search tree is created.
68.Fn tdelete 68.Fn tdelete
69deletes a node from the specified binary search tree and returns 69deletes a node from the specified binary search tree and returns
70a pointer to the parent of the node to be deleted. 70a pointer to the parent of the node to be deleted.
71If the node to be deleted is the root of the binary search tree,
72.Fa rootp
73will be adjusted and an unspecified non-null pointer will be returned.
71It takes the same arguments as 74It takes the same arguments as
72.Fn tfind 75.Fn tfind
73and 76and
74.Fn tsearch . 77.Fn tsearch .
75If the node to be deleted is the root of the binary search tree,
76.Fa rootp
77will be adjusted and a pointer to the new root will be returned.
78.Pp 78.Pp
79.Fn twalk 79.Fn twalk
80walks the binary search tree rooted in 80walks the binary search tree rooted in
@@ -96,6 +96,10 @@ function returns
96if allocation of a new node fails (usually 96if allocation of a new node fails (usually
97due to a lack of free memory). 97due to a lack of free memory).
98.Pp 98.Pp
99.Fn tdelete
100returns a pointer to the parent of the deleted node or an unspecified
101non-null pointer if the root node is deleted.
102.Pp
99.Fn tfind , 103.Fn tfind ,
100.Fn tsearch , 104.Fn tsearch ,
101and 105and
@@ -116,12 +120,11 @@ function returns no value.
116.Xr lsearch 3 120.Xr lsearch 3
117.Sh STANDARDS 121.Sh STANDARDS
118These functions conform to 122These functions conform to
119.St -p1003.1-2004 . 123.St -p1003.1-2008 .
120.Sh CAVEATS 124.Sh CAVEATS
121The 125The value returned when deleting the root node was unspecified before
122.St -p1003.1-2004 126the
123standard does not specify what value should be returned when deleting the 127.St -p1003.1-2008
124root node. 128standard, so users of the
125Since implementations vary, the user of the
126.Fn tdelete 129.Fn tdelete
127function should not rely on a specific behaviour. 130function should be wary of relying on a specific behaviour.