diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-11-20 20:13:21 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-11-20 20:13:21 +0300 |
commit | f4eb0173332488359c982003aafd5d31e31fe2b2 (patch) | |
tree | 10a952ec0a78a842d92390394012a1d6f8e5c28a /src/core/ngx_rbtree.c | |
parent | 67cd336d88f8a920ea5921936785a1c1553062fb (diff) |
ngx_rbtree_insert_value()
Diffstat (limited to 'src/core/ngx_rbtree.c')
-rw-r--r-- | src/core/ngx_rbtree.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/ngx_rbtree.c b/src/core/ngx_rbtree.c index ae973e5b0..a9d630520 100644 --- a/src/core/ngx_rbtree.c +++ b/src/core/ngx_rbtree.c @@ -100,6 +100,39 @@ ngx_rbtree_insert(ngx_thread_volatile ngx_rbtree_t *tree, 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) { |