s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

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 }