X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Flib%2Fkernel%2Flist.h;h=2388f9acdbf8e553d79ff6a27b93703020a3739e;hp=a041299f6701f02e9d840dc52dab9ab4077702d9;hb=f294e7e618e110f8203ea7cf800acb2e1334774b;hpb=13177c92575c4e0ddc1ca1600b24f5058e349bd3 diff --git a/src/lib/kernel/list.h b/src/lib/kernel/list.h index a041299..2388f9a 100644 --- a/src/lib/kernel/list.h +++ b/src/lib/kernel/list.h @@ -105,8 +105,9 @@ struct list name of the outer structure STRUCT and the member name MEMBER of the list element. See the big comment at the top of the file for an example. */ -#define list_entry(LIST_ELEM, STRUCT, MEMBER) \ - ((STRUCT *) ((uint8_t *) (LIST_ELEM) - offsetof (STRUCT, MEMBER))) +#define list_entry(LIST_ELEM, STRUCT, MEMBER) \ + ((STRUCT *) ((uint8_t *) &(LIST_ELEM)->next \ + - offsetof (STRUCT, MEMBER.next))) void list_init (struct list *);