shared: add nm_ether_addr_cmp()/nm_ether_addr_equal() helpers

This commit is contained in:
Thomas Haller 2020-09-24 12:55:12 +02:00
parent f37dd5d394
commit d9ca728005
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -96,6 +96,22 @@ typedef struct {
.ether_addr_octet = {__VA_ARGS__}, \
}
static inline int
nm_ether_addr_cmp(const NMEtherAddr *a, const NMEtherAddr *b)
{
NM_CMP_SELF(a, b);
NM_CMP_DIRECT_MEMCMP(a, b, sizeof(NMEtherAddr));
return 0;
}
static inline gboolean
nm_ether_addr_equal(const NMEtherAddr *a, const NMEtherAddr *b)
{
return nm_ether_addr_cmp(a, b) == 0;
}
/*****************************************************************************/
typedef struct {
union {
guint8 addr_ptr[1];