summaryrefslogtreecommitdiff
path: root/src/libs6/ftrigr_ack.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-07-16 15:56:05 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-07-16 15:56:05 +0000
commitd945bca329f7a13741e1d3afcf9f0f73f6c70ce9 (patch)
tree8a5018ae89923172361823ae24f737819ed4a9d2 /src/libs6/ftrigr_ack.c
parentf7c2e436ed0144d09cff0e3ac90f510a47f0aeac (diff)
downloads6-d945bca329f7a13741e1d3afcf9f0f73f6c70ce9.tar.xz
Add ftrigr_updateb()
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) ;
+ }
+}