From 1869e07b5f35533995428936f524659abd6b60e3 Mon Sep 17 00:00:00 2001 From: jasone Date: Wed, 14 May 2008 18:33:13 +0000 Subject: Clean up cpp logic and comments. --- lib/libc/stdlib/rb.h | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'lib') 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 + * #include + * ... + * + * 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 __FBSDID("$FreeBSD$"); -/* To disable assertions, #define NDEBUG before #include'ing rb.h. */ -#include - /* 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_ */ -- cgit v1.1