util: add fieldsizeof and fieldtypeof macros

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-06-17 14:17:40 +02:00
parent d088b819f9
commit 654bfae6f7
1 changed files with 2 additions and 0 deletions

View File

@ -80,6 +80,8 @@ typedef struct
#define ssizeof(foo) (ssize_t)sizeof(foo)
#define countof(foo) (ssizeof(foo) / ssizeof(foo[0]))
#define fieldsizeof(type_t, m) sizeof(((type_t *)0)->m)
#define fieldtypeof(type_t, m) typeof(((type_t *)0)->m)
#define p_alloca(type, count) \
((type *)memset(alloca(sizeof(type) * (count)), \