Lines Matching refs:cur
171 struct prio_tree_node *cur, *res = node; in prio_tree_insert() local
182 cur = root->prio_tree_node; in prio_tree_insert()
186 get_index(cur, &r_index, &h_index); in prio_tree_insert()
189 return cur; in prio_tree_insert()
194 node = prio_tree_replace(root, cur, node); in prio_tree_insert()
195 cur = tmp; in prio_tree_insert()
211 if (prio_tree_right_empty(cur)) { in prio_tree_insert()
213 cur->right = node; in prio_tree_insert()
214 node->parent = cur; in prio_tree_insert()
217 cur = cur->right; in prio_tree_insert()
219 if (prio_tree_left_empty(cur)) { in prio_tree_insert()
221 cur->left = node; in prio_tree_insert()
222 node->parent = cur; in prio_tree_insert()
225 cur = cur->left; in prio_tree_insert()
247 struct prio_tree_node *cur; in prio_tree_remove() local
250 cur = node; in prio_tree_remove()
252 while (!prio_tree_left_empty(cur) || !prio_tree_right_empty(cur)) { in prio_tree_remove()
253 if (!prio_tree_left_empty(cur)) in prio_tree_remove()
254 get_index(cur->left, &r_index, &h_index_left); in prio_tree_remove()
256 cur = cur->right; in prio_tree_remove()
260 if (!prio_tree_right_empty(cur)) in prio_tree_remove()
261 get_index(cur->right, &r_index, &h_index_right); in prio_tree_remove()
263 cur = cur->left; in prio_tree_remove()
269 cur = cur->left; in prio_tree_remove()
271 cur = cur->right; in prio_tree_remove()
274 if (prio_tree_root(cur)) { in prio_tree_remove()
275 assert(root->prio_tree_node == cur); in prio_tree_remove()
280 if (cur->parent->right == cur) in prio_tree_remove()
281 cur->parent->right = cur->parent; in prio_tree_remove()
283 cur->parent->left = cur->parent; in prio_tree_remove()
285 while (cur != node) in prio_tree_remove()
286 cur = prio_tree_replace(root, cur->parent, cur); in prio_tree_remove()
300 if (prio_tree_left_empty(iter->cur)) in prio_tree_left()
303 get_index(iter->cur->left, r_index, h_index); in prio_tree_left()
306 iter->cur = iter->cur->left; in prio_tree_left()
313 assert(prio_tree_left_empty(iter->cur)); in prio_tree_left()
314 assert(prio_tree_right_empty(iter->cur)); in prio_tree_left()
322 return iter->cur; in prio_tree_left()
333 if (prio_tree_right_empty(iter->cur)) in prio_tree_right()
344 get_index(iter->cur->right, r_index, h_index); in prio_tree_right()
347 iter->cur = iter->cur->right; in prio_tree_right()
355 assert(prio_tree_left_empty(iter->cur)); in prio_tree_right()
356 assert(prio_tree_right_empty(iter->cur)); in prio_tree_right()
364 return iter->cur; in prio_tree_right()
372 iter->cur = iter->cur->parent; in prio_tree_parent()
383 return iter->cur; in prio_tree_parent()
416 iter->cur = root->prio_tree_node; in prio_tree_first()
420 return iter->cur; in prio_tree_first()
442 if (iter->cur == NULL) in prio_tree_next()
448 return iter->cur; in prio_tree_next()
451 while (!prio_tree_root(iter->cur) && in prio_tree_next()
452 iter->cur->parent->right == iter->cur) in prio_tree_next()
455 if (prio_tree_root(iter->cur)) in prio_tree_next()
462 return iter->cur; in prio_tree_next()