| 5450 | } |
| 5451 | |
| 5452 | static void *tfind(const void *key, void **root, |
| 5453 | int (*compare)(const void *, const void *)) |
| 5454 | { |
| 5455 | if (root == NULL) |
| 5456 | return NULL; |
| 5457 | struct tree_s *t = (struct tree_s *)root; |
| 5458 | struct node_s *n = t->root; |
| 5459 | int cmp = 0; |
| 5460 | while (n != NULL) |
| 5461 | { |
| 5462 | cmp = compare(key, n->key); |
| 5463 | if (cmp < 0) |
| 5464 | n = TREE_LEFT(n); |
| 5465 | else if (cmp > 0) |
| 5466 | n = TREE_RIGHT(n); |
| 5467 | else |
| 5468 | return (void *)n; |
| 5469 | } |
| 5470 | return NULL; |
| 5471 | } |
| 5472 | static void *pool_tfind(struct malloc_pool_s *pool, const void *key, |
| 5473 | void **root, int (*compare)(const void *, const void *)) |
| 5474 | { |
no test coverage detected