Mercurial > hg > nginx
diff src/core/ngx_rbtree.c @ 861:4924b71d77f6
ngx_rbtree_insert_value()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 20 Nov 2006 17:13:21 +0000 |
parents | a7c8cbb4c55f |
children | 68cc5e2e1a5d |
line wrap: on
line diff
--- a/src/core/ngx_rbtree.c +++ b/src/core/ngx_rbtree.c @@ -100,6 +100,39 @@ ngx_rbtree_insert(ngx_thread_volatile ng void +ngx_rbtree_insert_value(ngx_rbtree_node_t *temp, ngx_rbtree_node_t *node, + ngx_rbtree_node_t *sentinel) +{ + for ( ;; ) { + + if (node->key < temp->key) { + + if (temp->left == sentinel) { + temp->left = node; + break; + } + + temp = temp->left; + + } else { + + if (temp->right == sentinel) { + temp->right = node; + break; + } + + temp = temp->right; + } + } + + node->parent = temp; + node->left = sentinel; + node->right = sentinel; + ngx_rbt_red(node); +} + + +void ngx_rbtree_insert_timer_value(ngx_rbtree_node_t *temp, ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel) {