actube/src/cw/mavl_get_node_cmp..c
7u83@mail.ru 257f1189b0 ac descriptor works
FossilOrigin-Name: 8e68ed51a2c8ee448474ab13ef8d0edbd8cfda5b5384684e2ed9ffa1fca4e799
2018-03-24 06:56:05 +00:00

19 lines
307 B
C

#include "mavl.h"
struct mavlnode * mavl_get_node_cmp(struct mavl *t ,void *data,
int ( *cmp ) ( const void *, const void * ))
{
struct mavlnode *n = t->root;
while(n){
int rc=cmp(data,mavlnode_dataptr(n));
if (rc==0)
return n;
if (rc<0)
n=n->left;
else
n=n->right;
}
return NULL;
}