diff --git a/src/core/ngx_rbtree.c b/src/core/ngx_rbtree.c index a9d630520..0a5753cdf 100644 --- a/src/core/ngx_rbtree.c +++ b/src/core/ngx_rbtree.c @@ -13,12 +13,6 @@ * 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, ngx_rbtree_node_t *sentinel, ngx_rbtree_node_t *node); diff --git a/src/core/ngx_rbtree.h b/src/core/ngx_rbtree.h index 16524ffc8..d7250f8ac 100644 --- a/src/core/ngx_rbtree.h +++ b/src/core/ngx_rbtree.h @@ -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); +#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 */ -#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 *