actube/src/cw/mavl_foreach_lr.c
7u83@mail.ru 4171d208d0 new mavl is working now
FossilOrigin-Name: 65a4eefffea57509c0d7fd573e53b15bf4a730ce297b7db182aaac796ea92448
2018-03-10 23:56:41 +00:00

18 lines
301 B
C

#include "mavl.h"
int mavl_foreach_lr(struct mavlnode *n, int (*callback)(void *,void *),void *cbpriv)
{
if (!n)
return 1;
if (!mavl_foreach_lr(n->left,callback,cbpriv))
return 0;
if (!callback(cbpriv,mavlnode_dataptr(n)))
return 0;
return mavl_foreach_lr(n->right,callback,cbpriv);
}