summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2008-05-14 18:33:13 +0000
committerjasone <jasone@FreeBSD.org>2008-05-14 18:33:13 +0000
commit1869e07b5f35533995428936f524659abd6b60e3 (patch)
tree9cefbc81d666671e4c37040a8bf80f34934957a4 /lib/libc
parent8a63cc8d3e9a3efa8540294e8e06fbb5b77e597d (diff)
downloadFreeBSD-src-1869e07b5f35533995428936f524659abd6b60e3.zip
FreeBSD-src-1869e07b5f35533995428936f524659abd6b60e3.tar.gz
Clean up cpp logic and comments.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/rb.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/libc/stdlib/rb.h b/lib/libc/stdlib/rb.h
index fe94a9f..80875b0 100644
--- a/lib/libc/stdlib/rb.h
+++ b/lib/libc/stdlib/rb.h
@@ -29,10 +29,21 @@
*
******************************************************************************
*
- * cpp macro implementation of left-leaning red-black trees. All operations
- * are done non-recursively. Parent pointers are not used, and color bits are
- * stored in the least significant bit of right-child pointers, thus making
- * node linkage as compact as is possible for red-black trees.
+ * cpp macro implementation of left-leaning red-black trees.
+ *
+ * Usage:
+ *
+ * (Optional, see assert(3).)
+ * #define NDEBUG
+ *
+ * (Required.)
+ * #include <assert.h>
+ * #include <rb.h>
+ * ...
+ *
+ * All operations are done non-recursively. Parent pointers are not used, and
+ * color bits are stored in the least significant bit of right-child pointers,
+ * thus making node linkage as compact as is possible for red-black trees.
*
* Some macros use a comparison function pointer, which is expected to have the
* following prototype:
@@ -53,12 +64,12 @@
*
******************************************************************************/
+#ifndef RB_H_
+#define RB_H_
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-/* To disable assertions, #define NDEBUG before #include'ing rb.h. */
-#include <assert.h>
-
/* Node structure. */
#define rb_node(a_type) \
struct { \
@@ -756,7 +767,7 @@ a_prefix##remove(a_tree_type *tree, a_type *node) { \
* effort.
*/
-#define rb_foreach_begin(a_type, a_field, a_tree, a_var) { \
+#define rb_foreach_begin(a_type, a_field, a_tree, a_var) { \
/* Compute the maximum possible tree depth (3X the black height). */\
unsigned rbp_f_height; \
rbp_black_height(a_type, a_field, a_tree, rbp_f_height); \
@@ -932,3 +943,5 @@ a_prefix##remove(a_tree_type *tree, a_type *node) { \
} \
} \
}
+
+#endif /* RB_H_ */
OpenPOWER on IntegriCloud