Merge branch 'ec/reftable-pass-pq-entry-by-reference'
Small code clean-up in reftable implementation. * ec/reftable-pass-pq-entry-by-reference: reftable: use a pointer for pq_entry param
This commit is contained in:
commit
f73ad8f75f
@ -36,7 +36,7 @@ static int merged_iter_init(struct merged_iter *mi)
|
||||
.rec = rec,
|
||||
.index = i,
|
||||
};
|
||||
merged_iter_pqueue_add(&mi->pq, e);
|
||||
merged_iter_pqueue_add(&mi->pq, &e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ static int merged_iter_advance_nonnull_subiter(struct merged_iter *mi,
|
||||
return 0;
|
||||
}
|
||||
|
||||
merged_iter_pqueue_add(&mi->pq, e);
|
||||
merged_iter_pqueue_add(&mi->pq, &e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq)
|
||||
return e;
|
||||
}
|
||||
|
||||
void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, struct pq_entry e)
|
||||
void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry *e)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@ -81,7 +81,7 @@ void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, struct pq_entry e)
|
||||
pq->cap * sizeof(struct pq_entry));
|
||||
}
|
||||
|
||||
pq->heap[pq->len++] = e;
|
||||
pq->heap[pq->len++] = *e;
|
||||
i = pq->len - 1;
|
||||
while (i > 0) {
|
||||
int j = (i - 1) / 2;
|
||||
|
@ -26,7 +26,7 @@ struct pq_entry merged_iter_pqueue_top(struct merged_iter_pqueue pq);
|
||||
int merged_iter_pqueue_is_empty(struct merged_iter_pqueue pq);
|
||||
void merged_iter_pqueue_check(struct merged_iter_pqueue pq);
|
||||
struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq);
|
||||
void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, struct pq_entry e);
|
||||
void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry *e);
|
||||
void merged_iter_pqueue_release(struct merged_iter_pqueue *pq);
|
||||
int pq_less(struct pq_entry *a, struct pq_entry *b);
|
||||
|
||||
|
@ -46,7 +46,7 @@ static void test_pq(void)
|
||||
.u.ref = {
|
||||
.refname = names[i],
|
||||
} } };
|
||||
merged_iter_pqueue_add(&pq, e);
|
||||
merged_iter_pqueue_add(&pq, &e);
|
||||
merged_iter_pqueue_check(pq);
|
||||
i = (i * 7) % N;
|
||||
} while (i != 1);
|
||||
|
Loading…
Reference in New Issue
Block a user