summaryrefslogtreecommitdiff
path: root/src/prioq.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
commita6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch)
treeb88cc7a8457658d67e0321718556ac807f6bccf3 /src/prioq.c
parent00be7622c428f279872f84569f098ce16150f8a8 (diff)
format files
Diffstat (limited to 'src/prioq.c')
-rw-r--r--src/prioq.c15
1 files changed, 8 insertions, 7 deletions
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;
}