ftrigr_ack.c (335B)
1 /* ISC license. */ 2 3 #include <stdint.h> 4 #include <skalibs/genalloc.h> 5 #include <s6/ftrigr.h> 6 7 void ftrigr_ack (ftrigr_t *a, size_t n) 8 { 9 size_t len = genalloc_len(uint16_t, &a->list) ; 10 a->head += n ; 11 if (a->head > len) a->head = len ; 12 if (a->head == len) 13 { 14 a->head = 0 ; 15 genalloc_setlen(uint16_t, &a->list, 0) ; 16 } 17 }