summaryrefslogtreecommitdiff
path: root/src/libdatastruct/genqdyn_pop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libdatastruct/genqdyn_pop.c')
-rw-r--r--src/libdatastruct/genqdyn_pop.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libdatastruct/genqdyn_pop.c b/src/libdatastruct/genqdyn_pop.c
new file mode 100644
index 0000000..c512099
--- /dev/null
+++ b/src/libdatastruct/genqdyn_pop.c
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+#include <errno.h>
+#include <skalibs/genqdyn.h>
+#include "genqdyn-internal.h"
+
+int genqdyn_pop (genqdyn *g)
+{
+ if (g->head >= g->queue.len) return (errno = EINVAL, 0) ;
+ g->head += g->esize ;
+ if (g->den * (g->queue.len - g->head) <= g->num * g->queue.len) genqdyn_clean(g) ;
+ return 1 ;
+}