/
githubmirror
/
ipxe
Обзор
Документация
Войти
/
githubmirror
/
ipxe
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v0.9.4
src/include/stddef.h
18 строк
414 B
Michael Brown
Added container_of(). This seems about the best place to put it, since
24 мар 2006, 01:07
24 мар 2006, 01:07
508dcdb
Код
Авторство
О чём код?
#ifndef STDDEF_H #define STDDEF_H /* for size_t */ #include <stdint.h> #undef NULL #define NULL ((void *)0) #undef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #undef container_of #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) #endif /* STDDEF_H */