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 <ps@pks.im> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Chandra Pratap committed
Aug 1, 2024 at 16:29 UTC
f1b60b7c666416b00f96e3f58552bfe52ca73130
1 file changed
+4
-13
reftable/pq.c
+4
-13
@@ -27,22 +27,16 @@ struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq)
27
pq->heap[0] = pq->heap[pq->len - 1];
28
pq->len--;
29
30
- i = 0;
30
while (i < pq->len) {
31
int min = i;
32
int j = 2 * i + 1;
33
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]))
35
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]))
37
min = k;
40
- }
41
-
42
- if (min == i) {
38
+ if (min == i)
39
break;
44
- }
45
-
40
SWAP(pq->heap[i], pq->heap[min]);
41
i = min;
42
}
@@ -60,12 +54,9 @@ void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry
54
i = pq->len - 1;
55
while (i > 0) {
56
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]))
58
break;
65
- }
66
-
59
SWAP(pq->heap[j], pq->heap[i]);
68
-
60
i = j;
61
}
62
}