ref: 7419d3ed430daac37d94c13ae5c5fc5859f66fd8
parent: 366cfab1bf689c387e90dfff1021fbace49a4aa2
author: Michael Forney <mforney@mforney.org>
date: Thu Feb 24 05:32:44 EST 2022
blk: simplify sync queue insert
--- a/blk.c
+++ b/blk.c
@@ -919,21 +919,17 @@
static void
qput(Flushq *q, Blk *b)
{
- Blk *t;
int i;
if(q->nheap == q->heapsz)
abort();
- q->heap[q->nheap] = b;
for(i = q->nheap; i > 0; i = (i-1)/2){
- if(blkcmp(q->heap[i], q->heap[(i-1)/2]) == 1)
+ if(blkcmp(b, q->heap[(i-1)/2]) == 1)
break;
- t = q->heap[i];
q->heap[i] = q->heap[(i-1)/2];
- q->heap[(i-1)/2] = t;
}
+ q->heap[i] = b;
q->nheap++;
-
}
static Blk*