summaryrefslogtreecommitdiff
path: root/src/libdatastruct/genqdyn_pop.c
blob: c512099eb58c71799d2ceb4bc827b9d5e361dce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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 ;
}