make global the rbtree color handling macros

This commit is contained in:
Igor Sysoev 2007-01-12 19:48:30 +00:00
parent 6a23cf06e8
commit 618dc75c2d
2 changed files with 8 additions and 7 deletions

View File

@ -13,12 +13,6 @@
* the "Introduction to Algorithms" by Cormen, Leiserson and Rivest. * the "Introduction to Algorithms" by Cormen, Leiserson and Rivest.
*/ */
#define ngx_rbt_red(node) ((node)->color = 1)
#define ngx_rbt_black(node) ((node)->color = 0)
#define ngx_rbt_is_red(node) ((node)->color)
#define ngx_rbt_is_black(node) (!ngx_rbt_is_red(node))
#define ngx_rbt_copy_color(n1, n2) (n1->color = n2->color)
static ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_node_t **root, static ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_node_t **root,
ngx_rbtree_node_t *sentinel, ngx_rbtree_node_t *node); ngx_rbtree_node_t *sentinel, ngx_rbtree_node_t *node);

View File

@ -50,9 +50,16 @@ void ngx_rbtree_insert_timer_value(ngx_rbtree_node_t *root,
ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel); ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
#define ngx_rbt_red(node) ((node)->color = 1)
#define ngx_rbt_black(node) ((node)->color = 0)
#define ngx_rbt_is_red(node) ((node)->color)
#define ngx_rbt_is_black(node) (!ngx_rbt_is_red(node))
#define ngx_rbt_copy_color(n1, n2) (n1->color = n2->color)
/* a sentinel must be black */ /* a sentinel must be black */
#define ngx_rbtree_sentinel_init(node) node->color = 0 #define ngx_rbtree_sentinel_init(node) ngx_rbt_black(node)
static ngx_inline ngx_rbtree_node_t * static ngx_inline ngx_rbtree_node_t *