Correctness: use __member2struct() on the correct fields.
The prev-pointers point to the next-pointers of the previous element -- not the ENTRY structure. The next-pointers are stored in the ENTRY structures first, so the code would already work correctly. Still, it is more accurate to use the next-fields. To prevent misuse of __member2struct() in the future, I've got a patch that requires the pointer to be passed to this macro to be compatible with the member of the structure. I'll commit this patch after I've tested it properly. MFC after: 1 month.
This commit is contained in:
parent
8f8f476390
commit
e48063402c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240426
@ -289,7 +289,7 @@ struct { \
|
||||
#define STAILQ_LAST(head, type, field) \
|
||||
(STAILQ_EMPTY((head)) ? \
|
||||
NULL : \
|
||||
__member2struct(type, field, (head)->stqh_last))
|
||||
__member2struct(type, field.stqe_next, (head)->stqh_last))
|
||||
|
||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||
|
||||
@ -427,7 +427,7 @@ struct { \
|
||||
#define LIST_PREV(elm, head, type, field) \
|
||||
((elm)->field.le_prev == &LIST_FIRST((head)) ? \
|
||||
NULL : \
|
||||
__member2struct(type, field, (elm)->field.le_prev))
|
||||
__member2struct(type, field.le_next, (elm)->field.le_prev))
|
||||
|
||||
#define LIST_REMOVE(elm, field) do { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.le_next); \
|
||||
|
Loading…
Reference in New Issue
Block a user