Files
lightning/ccan/ccan/structeq/structeq.h
Rusty Russell c91d2b5206 ccan: add local copy.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-12 13:29:06 +09:30

18 lines
567 B
C

/* CC0 (Public domain) - see LICENSE file for details */
#ifndef CCAN_STRUCTEQ_H
#define CCAN_STRUCTEQ_H
#include <string.h>
/**
* structeq - are two structures bitwise equal (including padding!)
* @a: a pointer to a structure
* @b: a pointer to a structure of the same type.
*
* If you *know* a structure has no padding, you can memcmp them. At
* least this way, the compiler will issue a warning if the structs are
* different types!
*/
#define structeq(a, b) \
(memcmp((a), (b), sizeof(*(a)) + 0 * sizeof((a) == (b))) == 0)
#endif /* CCAN_STRUCTEQ_H */