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

Function search

examples/test/avl.c:359–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359static struct rt_varea *search(struct util_avl_root *root,
360 struct _mm_range range,
361 int (*compare)(void *as, void *ae, void *bs,
362 void *be))
363{
364 struct util_avl_struct *node = root->root_node;
365 while (node)
366 {
367 rt_varea_t varea = VAREA_ENTRY(node);
368 int cmp = compare(range.start, range.end, varea->start,
369 varea->start + varea->size - 1);
370
371 if (cmp < 0)
372 {
373 node = node->avl_left;
374 }
375 else if (cmp > 0)
376 {
377 node = node->avl_right;
378 }
379 else
380 {
381 return varea;
382 }
383 }
384 return NULL;
385}
386
387struct rt_varea *_aspace_bst_search(struct rt_aspace *aspace, void *key)
388{

Callers 2

_aspace_bst_searchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected