Add a_type parameter to qr_{meld,split}().

This commit is contained in:
Jason Evans 2016-12-12 18:04:20 -08:00
parent fbe3015818
commit d4c5aceb7c
3 changed files with 11 additions and 11 deletions

View File

@ -445,7 +445,7 @@ JEMALLOC_INLINE void
extent_ring_insert(extent_t *sentinel, extent_t *extent)
{
qr_meld(sentinel, extent, qr_link);
qr_meld(sentinel, extent, extent_t, qr_link);
}
JEMALLOC_INLINE void

View File

@ -31,8 +31,8 @@ struct { \
(a_qrelm)->a_field.qre_next = (a_qr); \
} while (0)
#define qr_meld(a_qr_a, a_qr_b, a_field) do { \
void *t; \
#define qr_meld(a_qr_a, a_qr_b, a_type, a_field) do { \
a_type *t; \
(a_qr_a)->a_field.qre_prev->a_field.qre_next = (a_qr_b); \
(a_qr_b)->a_field.qre_prev->a_field.qre_next = (a_qr_a); \
t = (a_qr_a)->a_field.qre_prev; \
@ -44,8 +44,8 @@ struct { \
* qr_meld() and qr_split() are functionally equivalent, so there's no need to
* have two copies of the code.
*/
#define qr_split(a_qr_a, a_qr_b, a_field) \
qr_meld((a_qr_a), (a_qr_b), a_field)
#define qr_split(a_qr_a, a_qr_b, a_type, a_field) \
qr_meld((a_qr_a), (a_qr_b), a_type, a_field)
#define qr_remove(a_qr, a_field) do { \
(a_qr)->a_field.qre_prev->a_field.qre_next \

View File

@ -215,22 +215,22 @@ TEST_BEGIN(test_qr_meld_split)
for (i = 1; i < NENTRIES; i++)
qr_after_insert(&entries[i - 1], &entries[i], link);
qr_split(&entries[0], &entries[SPLIT_INDEX], link);
qr_split(&entries[0], &entries[SPLIT_INDEX], ring_t, link);
test_split_entries(entries);
qr_meld(&entries[0], &entries[SPLIT_INDEX], link);
qr_meld(&entries[0], &entries[SPLIT_INDEX], ring_t, link);
test_entries_ring(entries);
qr_meld(&entries[0], &entries[SPLIT_INDEX], link);
qr_meld(&entries[0], &entries[SPLIT_INDEX], ring_t, link);
test_split_entries(entries);
qr_split(&entries[0], &entries[SPLIT_INDEX], link);
qr_split(&entries[0], &entries[SPLIT_INDEX], ring_t, link);
test_entries_ring(entries);
qr_split(&entries[0], &entries[0], link);
qr_split(&entries[0], &entries[0], ring_t, link);
test_entries_ring(entries);
qr_meld(&entries[0], &entries[0], link);
qr_meld(&entries[0], &entries[0], ring_t, link);
test_entries_ring(entries);
}
TEST_END