This is the macro definition:
I do not understand why ptr is thrown on (char *) . Can't I just subtract member offset from ptr ? Like this:
#define list_entry(ptr, type, member) \ ((type *)((ptr)-(unsigned long)(&((type *)0)->member)))
Thanks!
source share