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