diff options
author | guenther <> | 2012-07-08 10:14:35 +0000 |
---|---|---|
committer | guenther <> | 2012-07-08 10:14:35 +0000 |
commit | 34dd7f38ef26cac3e96d931dccf15e449563463d (patch) | |
tree | 66d837d0800e5f17c05c617535bd25fc3ffa816c /src | |
parent | 995c38cd464be88005853d62d9c8ac2d96f6dfe1 (diff) | |
download | openbsd-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.3 | 27 |
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 |
69 | deletes a node from the specified binary search tree and returns | 69 | deletes a node from the specified binary search tree and returns |
70 | a pointer to the parent of the node to be deleted. | 70 | a pointer to the parent of the node to be deleted. |
71 | If the node to be deleted is the root of the binary search tree, | ||
72 | .Fa rootp | ||
73 | will be adjusted and an unspecified non-null pointer will be returned. | ||
71 | It takes the same arguments as | 74 | It takes the same arguments as |
72 | .Fn tfind | 75 | .Fn tfind |
73 | and | 76 | and |
74 | .Fn tsearch . | 77 | .Fn tsearch . |
75 | If the node to be deleted is the root of the binary search tree, | ||
76 | .Fa rootp | ||
77 | will be adjusted and a pointer to the new root will be returned. | ||
78 | .Pp | 78 | .Pp |
79 | .Fn twalk | 79 | .Fn twalk |
80 | walks the binary search tree rooted in | 80 | walks the binary search tree rooted in |
@@ -96,6 +96,10 @@ function returns | |||
96 | if allocation of a new node fails (usually | 96 | if allocation of a new node fails (usually |
97 | due to a lack of free memory). | 97 | due to a lack of free memory). |
98 | .Pp | 98 | .Pp |
99 | .Fn tdelete | ||
100 | returns a pointer to the parent of the deleted node or an unspecified | ||
101 | non-null pointer if the root node is deleted. | ||
102 | .Pp | ||
99 | .Fn tfind , | 103 | .Fn tfind , |
100 | .Fn tsearch , | 104 | .Fn tsearch , |
101 | and | 105 | and |
@@ -116,12 +120,11 @@ function returns no value. | |||
116 | .Xr lsearch 3 | 120 | .Xr lsearch 3 |
117 | .Sh STANDARDS | 121 | .Sh STANDARDS |
118 | These functions conform to | 122 | These functions conform to |
119 | .St -p1003.1-2004 . | 123 | .St -p1003.1-2008 . |
120 | .Sh CAVEATS | 124 | .Sh CAVEATS |
121 | The | 125 | The value returned when deleting the root node was unspecified before |
122 | .St -p1003.1-2004 | 126 | the |
123 | standard does not specify what value should be returned when deleting the | 127 | .St -p1003.1-2008 |
124 | root node. | 128 | standard, so users of the |
125 | Since implementations vary, the user of the | ||
126 | .Fn tdelete | 129 | .Fn tdelete |
127 | function should not rely on a specific behaviour. | 130 | function should be wary of relying on a specific behaviour. |