Skip to content

Commit f1b60b7

Browse files
Chandra Pratapgitster
authored andcommitted
reftable: remove unnecessary curly braces in reftable/pq.c
According to Documentation/CodingGuidelines, control-flow statements with a single line as their body must omit curly braces. Make reftable/pq.c conform to this guideline. Besides that, remove unnecessary newlines and variable assignment. Mentored-by: Patrick Steinhardt <[email protected]> Mentored-by: Christian Couder <[email protected]> Signed-off-by: Chandra Pratap <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 39bf06a commit f1b60b7

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

reftable/pq.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,16 @@ struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq)
2727
pq->heap[0] = pq->heap[pq->len - 1];
2828
pq->len--;
2929

30-
i = 0;
3130
while (i < pq->len) {
3231
int min = i;
3332
int j = 2 * i + 1;
3433
int k = 2 * i + 2;
35-
if (j < pq->len && pq_less(&pq->heap[j], &pq->heap[i])) {
34+
if (j < pq->len && pq_less(&pq->heap[j], &pq->heap[i]))
3635
min = j;
37-
}
38-
if (k < pq->len && pq_less(&pq->heap[k], &pq->heap[min])) {
36+
if (k < pq->len && pq_less(&pq->heap[k], &pq->heap[min]))
3937
min = k;
40-
}
41-
42-
if (min == i) {
38+
if (min == i)
4339
break;
44-
}
45-
4640
SWAP(pq->heap[i], pq->heap[min]);
4741
i = min;
4842
}
@@ -60,12 +54,9 @@ void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry
6054
i = pq->len - 1;
6155
while (i > 0) {
6256
int j = (i - 1) / 2;
63-
if (pq_less(&pq->heap[j], &pq->heap[i])) {
57+
if (pq_less(&pq->heap[j], &pq->heap[i]))
6458
break;
65-
}
66-
6759
SWAP(pq->heap[j], pq->heap[i]);
68-
6960
i = j;
7061
}
7162
}

0 commit comments

Comments
 (0)