This diff moves the documentation of the return values of
{RB,SPLAY}_{INSERT,REMOVE} from the NOTES section (where it is hard to
find) to the place where each function is described. (Note that the
RB_INSERT description already documents the return values.)
Regards,
Tim
Index: tree.3
===================================================================
RCS file: /cvs/src/share/man/man3/tree.3,v
retrieving revision 1.20
diff -u tree.3
--- tree.3 28 Jan 2009 12:22:48 -0000 1.20
+++ tree.3 3 May 2010 19:55:38 -0000
@@ -258,6 +258,11 @@
macro inserts the new element
.Fa elm
into the tree.
+Upon success,
+.Va NULL
+is returned.
+If a matching element already exists in the tree, the insertion is
+aborted, and a pointer to the existing element is returned.
.Pp
The
.Fn SPLAY_REMOVE
@@ -265,6 +270,10 @@
.Fa elm
from the tree pointed by
.Fa head .
+Upon success, a pointer to the removed element is returned.
+Otherwise,
+.Va NULL
+is returned to indicate an error.
.Pp
The
.Fn SPLAY_FIND
@@ -405,6 +414,10 @@
.Fa elm
from the tree pointed by
.Fa head .
+Upon success, a pointer to the removed element is returned.
+Otherwise,
+.Va NULL
+is returned to indicate an error.
.Pp
The
.Fn RB_FIND
@@ -543,22 +556,5 @@
free(var);
}
.Ed
-.Pp
-Both
-.Fn RB_INSERT
-and
-.Fn SPLAY_INSERT
-return
-.Va NULL
-if the element was inserted in the tree successfully, otherwise they
-return a pointer to the element with the colliding key.
-.Pp
-Accordingly,
-.Fn RB_REMOVE
-and
-.Fn SPLAY_REMOVE
-return the pointer to the removed element, otherwise they return
-.Va NULL
-to indicate an error.
.Sh AUTHORS
The author of the tree macros is Niels Provos.