shared,platform: take pointer to NMEtherAddr in NM_ETHER_ADDR_FORMAT_VAL() macro

It seems nicer to require a pointer than the plain struct.
This commit is contained in:
Thomas Haller 2020-10-13 11:11:25 +02:00
parent 6807774b7d
commit 28bbe2a798
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
4 changed files with 12 additions and 10 deletions

View file

@ -656,11 +656,11 @@ NM_G_ERROR_MSG(GError *error)
#if _NM_CC_SUPPORT_GENERIC
/* returns @value, if the type of @value matches @type.
* This requires support for C11 _Generic(). If no support is
* present, this returns @value directly.
*
* It's useful to check the let the compiler ensure that @value is
* of a certain type. */
* This requires support for C11 _Generic(). If no support is
* present, this returns @value directly.
*
* It's useful to check the let the compiler ensure that @value is
* of a certain type. */
#define _NM_ENSURE_TYPE(type, value) (_Generic((value), type : (value)))
#define _NM_ENSURE_TYPE_CONST(type, value) \
(_Generic((value), const type \

View file

@ -88,9 +88,11 @@ typedef struct {
} NMEtherAddr;
#define NM_ETHER_ADDR_FORMAT_STR "%02X:%02X:%02X:%02X:%02X:%02X"
#define NM_ETHER_ADDR_FORMAT_VAL(x) \
(x).ether_addr_octet[0], (x).ether_addr_octet[1], (x).ether_addr_octet[2], \
(x).ether_addr_octet[3], (x).ether_addr_octet[4], (x).ether_addr_octet[5]
#define NM_ETHER_ADDR_FORMAT_VAL(x) \
(x)->ether_addr_octet[0], (x)->ether_addr_octet[1], (x)->ether_addr_octet[2], \
(x)->ether_addr_octet[3], (x)->ether_addr_octet[4], (x)->ether_addr_octet[5]
#define NM_ETHER_ADDR_INIT(...) \
{ \
.ether_addr_octet = {__VA_ARGS__}, \

View file

@ -5641,7 +5641,7 @@ nm_platform_lnk_bridge_to_string(const NMPlatformLnkBridge *lnk, char *buf, gsiz
lnk->vlan_protocol,
(int) lnk->vlan_stats_enabled,
lnk->group_fwd_mask,
NM_ETHER_ADDR_FORMAT_VAL(lnk->group_addr),
NM_ETHER_ADDR_FORMAT_VAL(&lnk->group_addr),
(int) lnk->mcast_snooping,
lnk->mcast_router,
(int) lnk->mcast_query_use_ifaddr,

View file

@ -1477,7 +1477,7 @@ nmtstp_link_bridge_add(NMPlatform * platform,
lnk->group_fwd_mask != 0
? nm_sprintf_buf(sbuf_gfw, "group_fwd_mask %#x ", lnk->group_fwd_mask)
: "",
NM_ETHER_ADDR_FORMAT_VAL(lnk->group_addr),
NM_ETHER_ADDR_FORMAT_VAL(&lnk->group_addr),
(int) lnk->mcast_snooping,
lnk->mcast_router,
(int) lnk->mcast_query_use_ifaddr,