summaryrefslogtreecommitdiff
path: root/sqmail-4.3.07/src/prioq.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 11:44:11 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 11:44:11 +0200
commitf1b71c9fe7dbb4886588a036399cf5ebe16b7c47 (patch)
treee07786aa479c9fb6ee3e537078470aaab5454f80 /sqmail-4.3.07/src/prioq.c
parenta293489ee83c8b05d845a162dc2a4de026f3775d (diff)
removed top level directory
Diffstat (limited to 'sqmail-4.3.07/src/prioq.c')
-rw-r--r--sqmail-4.3.07/src/prioq.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/sqmail-4.3.07/src/prioq.c b/sqmail-4.3.07/src/prioq.c
deleted file mode 100644
index 9559d31..0000000
--- a/sqmail-4.3.07/src/prioq.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#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)
-
-int prioq_insert(prioq *pq, struct prioq_elt *pe)
-{
- int i;
- int j;
-
- if (!prioq_readyplus(pq,1)) return 0;
- j = pq->len++;
- while (j) {
- i = (j - 1)/2;
- if (pq->p[i].dt <= pe->dt) break;
- pq->p[j] = pq->p[i];
- j = i;
- }
- pq->p[j] = *pe;
- return 1;
-}
-
-int prioq_min(prioq *pq, struct prioq_elt *pe)
-{
- if (!pq->p) return 0;
- if (!pq->len) return 0;
- *pe = pq->p[0];
- return 1;
-}
-
-void prioq_delmin(prioq *pq)
-{
- int i;
- int j;
- int n;
-
- if (!pq->p) return;
- n = pq->len;
- if (!n) return;
- i = 0;
- --n;
-
- for (;;) {
- j = i + i + 2;
- if (j > n) break;
- if (pq->p[j - 1].dt <= pq->p[j].dt) --j;
- if (pq->p[n].dt <= pq->p[j].dt) break;
- pq->p[i] = pq->p[j];
- i = j;
- }
- pq->p[i] = pq->p[n];
- pq->len = n;
-}