Blame libiptc/linux_stddef.h

Packit 7b22a4
#ifndef _LINUX_STDDEF_H
Packit 7b22a4
#define _LINUX_STDDEF_H
Packit 7b22a4
Packit 7b22a4
#undef NULL
Packit 7b22a4
#if defined(__cplusplus)
Packit 7b22a4
#define NULL 0
Packit 7b22a4
#else
Packit 7b22a4
#define NULL ((void *)0)
Packit 7b22a4
#endif
Packit 7b22a4
Packit 7b22a4
#undef offsetof
Packit 7b22a4
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
Packit 7b22a4
Packit 7b22a4
Packit 7b22a4
/**
Packit 7b22a4
 * container_of - cast a member of a structure out to the containing structure
Packit 7b22a4
 *
Packit 7b22a4
 * @ptr:	the pointer to the member.
Packit 7b22a4
 * @type:	the type of the container struct this is embedded in.
Packit 7b22a4
 * @member:	the name of the member within the struct.
Packit 7b22a4
 *
Packit 7b22a4
 */
Packit 7b22a4
#define container_of(ptr, type, member) ({			\
Packit 7b22a4
        const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
Packit 7b22a4
        (type *)( (char *)__mptr - offsetof(type,member) );})
Packit 7b22a4
Packit 7b22a4
/*
Packit 7b22a4
 * Check at compile time that something is of a particular type.
Packit 7b22a4
 * Always evaluates to 1 so you may use it easily in comparisons.
Packit 7b22a4
 */
Packit 7b22a4
#define typecheck(type,x) \
Packit 7b22a4
({	type __dummy; \
Packit 7b22a4
	typeof(x) __dummy2; \
Packit 7b22a4
	(void)(&__dummy == &__dummy2); \
Packit 7b22a4
	1; \
Packit 7b22a4
})
Packit 7b22a4
Packit 7b22a4
Packit 7b22a4
#endif