257f1189b0
FossilOrigin-Name: 8e68ed51a2c8ee448474ab13ef8d0edbd8cfda5b5384684e2ed9ffa1fca4e799
19 lines
307 B
C
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;
|
|
}
|