avlnode_iter_withcancel.c (434B)
1 /* ISC license. */ 2 3 #include <errno.h> 4 #include <skalibs/avlnode.h> 5 6 int avlnode_iter_withcancel (avlnode *tree, uint32_t max, uint32_t root, avliter_func_ref f, avliter_func_ref cancelf, void *stuff) 7 { 8 uint32_t cut = avlnode_iter_nocancel(tree, max, max, root, f, stuff) ; 9 if (cut != max) 10 { 11 int e = errno ; 12 avlnode_iter_nocancel(tree, max, cut, root, cancelf, stuff) ; 13 errno = e ; 14 return 0 ; 15 } 16 return 1 ; 17 }