MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / lwp_avl_find

Function lwp_avl_find

components/lwp/lwp_avl.c:206–222  ·  view source on GitHub ↗

* @brief Finds a node in an AVL tree by key * * @param[in] key The key to search for in the AVL tree * @param[in] ptree Pointer to the root node of the AVL tree * * @return struct lwp_avl_struct* Pointer to the found node, or NULL if not found * * @note This function searches the AVL tree for a node with the specified key. * It performs a standard binary search by comparing keys and

Source from the content-addressed store, hash-verified

204 * left or right subtrees accordingly.
205 */
206struct lwp_avl_struct *lwp_avl_find(avl_key_t key, struct lwp_avl_struct *ptree)
207{
208 for (;;)
209 {
210 if (ptree == AVL_EMPTY)
211 {
212 return (struct lwp_avl_struct *)0;
213 }
214 if (key == ptree->avl_key)
215 break;
216 if (key < ptree->avl_key)
217 ptree = ptree->avl_left;
218 else
219 ptree = ptree->avl_right;
220 }
221 return ptree;
222}
223
224/**
225 * @brief Recursively traverses an AVL tree and applies a function to each node

Callers 14

lwp_pid_get_lockedFunction · 0.85
lwp_pid_put_lockedFunction · 0.85
lwp_pid_set_lwp_lockedFunction · 0.85
lwp_user_object_addFunction · 0.85
lwp_user_object_deleteFunction · 0.85
lwp_from_pid_raw_lockedFunction · 0.85
_pftx_getFunction · 0.85
lwp_tid_getFunction · 0.85
lwp_tid_putFunction · 0.85
lwp_tid_get_thread_rawFunction · 0.85
lwp_tid_set_threadFunction · 0.85
_lwp_shmgetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected