blob: 3af20c53938ce73276da8afa7dfa441d9f3766ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/* 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 */
|