summaryrefslogtreecommitdiff
path: root/src/libs6/ftrigr_ack.c
blob: 5c9a9f3aeb57d20f0fb240ab40333832b9367011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* ISC license. */

#include <stdint.h>
#include <skalibs/genalloc.h>
#include <s6/ftrigr.h>

void ftrigr_ack (ftrigr_t *a, size_t n)
{
  size_t len = genalloc_len(uint16_t, &a->list) ;
  a->head += n ;
  if (a->head > len) a->head = len ;
  if (a->head == len)
  {
    a->head = 0 ;
    genalloc_setlen(uint16_t, &a->list, 0) ;
  }
}