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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx/

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux