Thread (100 messages) flat view 100 messages, 4 authors, 2022-01-13
STALE1676d

[PATCH 1/4] fixup! reftable: add a heap-based priority queue for reftable records

From: Carlo Marcelo Arenas Belón <hidden>
Date: 2021-09-30 05:40:49
Subsystem: the rest · Maintainer: Linus Torvalds

originally discussed as part of the -DNDEBUG thread[1], but still likely
to break the build with the parent variable set but not used when assert
gets compiled out.

moving to BUG or DIE still a better option otherwise, but this fixup will
at least address that specific problem (even if the function then is a
NOOP).

[1] https://lore.kernel.org/git/20210902053023.44006-4-carenas@gmail.com/ (local)

Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
---
 reftable/pq_test.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/reftable/pq_test.c b/reftable/pq_test.c
index aaa86d1224..a678848743 100644
--- a/reftable/pq_test.c
+++ b/reftable/pq_test.c
@@ -17,11 +17,9 @@ license that can be found in the LICENSE file or at
 
 void merged_iter_pqueue_check(struct merged_iter_pqueue pq)
 {
-	int i = 0;
+	int i;
 	for (i = 1; i < pq.len; i++) {
-		int parent = (i - 1) / 2;
-
-		assert(pq_less(&pq.heap[parent], &pq.heap[i]));
+		assert(pq_less(&pq.heap[(i - 1)/2], &pq.heap[i]));
 	}
 }
 
-- 
2.33.0.955.gee03ddbf0e
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help