From a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:52:39 +0200 Subject: format files --- src/prioq.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/prioq.c') diff --git a/src/prioq.c b/src/prioq.c index 9559d31..7cd29e8 100644 --- a/src/prioq.c +++ b/src/prioq.c @@ -1,18 +1,19 @@ +#include "prioq.h" + #include "alloc.h" #include "genalloc.h" -#include "prioq.h" -GEN_ALLOC_readyplus(prioq,struct prioq_elt,p,len,a,i,n,x,100,prioq_readyplus) +GEN_ALLOC_readyplus(prioq, struct prioq_elt, p, len, a, i, n, x, 100, prioq_readyplus) -int prioq_insert(prioq *pq, struct prioq_elt *pe) + int prioq_insert(prioq *pq, struct prioq_elt *pe) { int i; int j; - if (!prioq_readyplus(pq,1)) return 0; + if (!prioq_readyplus(pq, 1)) return 0; j = pq->len++; while (j) { - i = (j - 1)/2; + i = (j - 1) / 2; if (pq->p[i].dt <= pe->dt) break; pq->p[j] = pq->p[i]; j = i; @@ -49,6 +50,6 @@ void prioq_delmin(prioq *pq) pq->p[i] = pq->p[j]; i = j; } - pq->p[i] = pq->p[n]; - pq->len = n; + pq->p[i] = pq->p[n]; + pq->len = n; } -- cgit v1.2.3