ac descriptor works
FossilOrigin-Name: 8e68ed51a2c8ee448474ab13ef8d0edbd8cfda5b5384684e2ed9ffa1fca4e799
This commit is contained in:
18
src/cw/mavl_get_node_cmp..c
Normal file
18
src/cw/mavl_get_node_cmp..c
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user