summaryrefslogtreecommitdiff
path: root/src/libs6/ftrigr_ack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs6/ftrigr_ack.c')
-rw-r--r--src/libs6/ftrigr_ack.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libs6/ftrigr_ack.c b/src/libs6/ftrigr_ack.c
new file mode 100644
index 0000000..5c9a9f3
--- /dev/null
+++ b/src/libs6/ftrigr_ack.c
@@ -0,0 +1,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) ;
+ }
+}