Author: ed Date: Wed Sep 12 22:54:11 2012 New Revision: 240426 URL: http://svn.freebsd.org/changeset/base/240426
Log: 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. Modified: head/sys/sys/queue.h Modified: head/sys/sys/queue.h ============================================================================== --- head/sys/sys/queue.h Wed Sep 12 22:16:31 2012 (r240425) +++ head/sys/sys/queue.h Wed Sep 12 22:54:11 2012 (r240426) @@ -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); \ _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"