f4ebe841a5
FossilOrigin-Name: 8a43dd9d05a4cb73210243ddd8df2a26f16c7ef2c4d4e36ab446de1f65d88223
34 lines
557 B
C
34 lines
557 B
C
|
|
|
|
|
|
int avltree_foreach_lr_node(struct avltree *t, struct avlnode *n, void *data,int (*callback)(void *,void *),void *cbpriv)
|
|
{
|
|
if (!n)
|
|
return 1;
|
|
|
|
int rc=t->cmp(data,n->data);
|
|
if (rc<0){
|
|
avltree_foreach_lr_node(t,n->left,data,callback,cbpriv);
|
|
callback(cbpriv,n->data);
|
|
avltree_foreach_lr(n->right,
|
|
return 0;
|
|
}
|
|
|
|
if (rc>0) {
|
|
avltree_foreach_lr_node(t,n->right,data,callback,cbpriv);
|
|
return 0;
|
|
}
|
|
|
|
return callback(cbpriv,n->data);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
int avltree_foreach_2(struct avltree *t,void *data,int (*callback)(void *,void *),void *cbpriv)
|
|
{
|
|
|
|
}
|