mirror of
https://github.com/nginx/nginx.git
synced 2024-12-04 22:09:01 +08:00
ngx_rbtree_insert_value()
This commit is contained in:
parent
67cd336d88
commit
f4eb017333
@ -99,6 +99,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)
|
||||
|
@ -44,6 +44,8 @@ void ngx_rbtree_insert(ngx_thread_volatile ngx_rbtree_t *tree,
|
||||
ngx_rbtree_node_t *node);
|
||||
void ngx_rbtree_delete(ngx_thread_volatile ngx_rbtree_t *tree,
|
||||
ngx_rbtree_node_t *node);
|
||||
void ngx_rbtree_insert_value(ngx_rbtree_node_t *root, ngx_rbtree_node_t *node,
|
||||
ngx_rbtree_node_t *sentinel);
|
||||
void ngx_rbtree_insert_timer_value(ngx_rbtree_node_t *root,
|
||||
ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user