gensetdyn_iter_withcancel.c (414B)
1 /* ISC license. */ 2 3 #include <stdint.h> 4 #include <errno.h> 5 6 #include <skalibs/gensetdyn.h> 7 8 int gensetdyn_iter_withcancel (gensetdyn *g, iter_func_ref f, iter_func_ref cancelf, void *stuff) 9 { 10 uint32_t n = gensetdyn_iter_nocancel(g, gensetdyn_n(g), f, stuff) ; 11 if (n < gensetdyn_n(g)) 12 { 13 int e = errno ; 14 gensetdyn_iter_nocancel(g, n, cancelf, stuff) ; 15 errno = e ; 16 return 0 ; 17 } 18 return 1 ; 19 }