mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-27 09:44:28 +01:00
18 lines
567 B
C
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 */
|