ck_queue: Fix CK_LIST_INSERT_HEAD.

CK_LIST_INSERT_HEAD was incorrectly managing prev
pointer on insertion to non-empty list. This bug
would cause erroneous behavior on CK_LIST_REMOVE
to non-head elements. Unit test will be updated
for this regression.
ck_pring
Abel Mathew 12 years ago committed by Samy Al Bahra
parent e517126247
commit 25658c4f5f

@ -258,9 +258,9 @@ struct { \
#define CK_LIST_INSERT_HEAD(head, elm, field) do { \
(elm)->field.le_next = (head)->lh_first; \
ck_pr_fence_store(); \
ck_pr_store_ptr(&(head)->lh_first, elm); \
if ((elm)->field.le_next != NULL) \
(head)->lh_first->field.le_prev = &(elm)->field.le_next; \
ck_pr_store_ptr(&(head)->lh_first, elm); \
(elm)->field.le_prev = &(head)->lh_first; \
} while (0)

Loading…
Cancel
Save