Klaus Demo nginx / 618dc75
make global the rbtree color handling macros Igor Sysoev 15 years ago
2 changed file(s) with 8 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1111 * The red-black tree code is based on the algorithm described in
1212 * the "Introduction to Algorithms" by Cormen, Leiserson and Rivest.
1313 */
14
15 #define ngx_rbt_red(node) ((node)->color = 1)
16 #define ngx_rbt_black(node) ((node)->color = 0)
17 #define ngx_rbt_is_red(node) ((node)->color)
18 #define ngx_rbt_is_black(node) (!ngx_rbt_is_red(node))
19 #define ngx_rbt_copy_color(n1, n2) (n1->color = n2->color)
2014
2115
2216 static ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_node_t **root,
4949 ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
5050
5151
52 #define ngx_rbt_red(node) ((node)->color = 1)
53 #define ngx_rbt_black(node) ((node)->color = 0)
54 #define ngx_rbt_is_red(node) ((node)->color)
55 #define ngx_rbt_is_black(node) (!ngx_rbt_is_red(node))
56 #define ngx_rbt_copy_color(n1, n2) (n1->color = n2->color)
57
58
5259 /* a sentinel must be black */
5360
54 #define ngx_rbtree_sentinel_init(node) node->color = 0
61 #define ngx_rbtree_sentinel_init(node) ngx_rbt_black(node)
5562
5663
5764 static ngx_inline ngx_rbtree_node_t *