Klaus Demo nginx / f4eb017
ngx_rbtree_insert_value() Igor Sysoev 15 years ago
2 changed file(s) with 35 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
9595 }
9696
9797 ngx_rbt_black(*root);
98 }
99
100
101 void
102 ngx_rbtree_insert_value(ngx_rbtree_node_t *temp, ngx_rbtree_node_t *node,
103 ngx_rbtree_node_t *sentinel)
104 {
105 for ( ;; ) {
106
107 if (node->key < temp->key) {
108
109 if (temp->left == sentinel) {
110 temp->left = node;
111 break;
112 }
113
114 temp = temp->left;
115
116 } else {
117
118 if (temp->right == sentinel) {
119 temp->right = node;
120 break;
121 }
122
123 temp = temp->right;
124 }
125 }
126
127 node->parent = temp;
128 node->left = sentinel;
129 node->right = sentinel;
130 ngx_rbt_red(node);
98131 }
99132
100133
4343 ngx_rbtree_node_t *node);
4444 void ngx_rbtree_delete(ngx_thread_volatile ngx_rbtree_t *tree,
4545 ngx_rbtree_node_t *node);
46 void ngx_rbtree_insert_value(ngx_rbtree_node_t *root, ngx_rbtree_node_t *node,
47 ngx_rbtree_node_t *sentinel);
4648 void ngx_rbtree_insert_timer_value(ngx_rbtree_node_t *root,
4749 ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
4850