mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-28 19:20:49 +02:00
glib-aux: move nm_ether_addr_zero to "libnm-glib-aux/nm-shared-utils.h"
It belongs there, beside NMEtherAddr. Maybe NMEtherAddr should be moved to a separate header, but it here for now. The only oddity is that nm_ether_addr_zero actually aliases nm_ip_addr_zero, which is in "libnm-glib-aux/nm-inet-utils.h". We can workaround that.
This commit is contained in:
parent
996b679bd0
commit
2fb8ce9188
2 changed files with 8 additions and 4 deletions
|
|
@ -51,10 +51,6 @@ typedef struct _NMIPAddr {
|
|||
|
||||
extern const NMIPAddr nm_ip_addr_zero;
|
||||
|
||||
/* This doesn't really belong here, but since it's convenient to re-use nm_ip_addr_zero.ether_addr
|
||||
* for NMEtherAddr, it is. */
|
||||
#define nm_ether_addr_zero (nm_ip_addr_zero.ether_addr)
|
||||
|
||||
static inline int
|
||||
nm_ip_addr_cmp(int addr_family, gconstpointer a, gconstpointer b)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -198,6 +198,13 @@ typedef struct {
|
|||
|
||||
#define NM_ETHER_ADDR_INIT(...) ((NMEtherAddr) _NM_ETHER_ADDR_INIT(__VA_ARGS__))
|
||||
|
||||
struct _NMIPAddr;
|
||||
extern const struct _NMIPAddr nm_ip_addr_zero;
|
||||
|
||||
/* Let's reuse nm_ip_addr_zero also for nm_ether_addr_zero. It's a union that
|
||||
* also contains a NMEtherAddr field. */
|
||||
#define nm_ether_addr_zero (*((const NMEtherAddr *) ((gconstpointer) &nm_ip_addr_zero)))
|
||||
|
||||
static inline int
|
||||
nm_ether_addr_cmp(const NMEtherAddr *a, const NMEtherAddr *b)
|
||||
{
|
||||
|
|
@ -221,6 +228,7 @@ nm_utils_ether_addr_cmp(const struct ether_addr *a1, const struct ether_addr *a2
|
|||
{
|
||||
nm_assert(a1);
|
||||
nm_assert(a2);
|
||||
|
||||
return memcmp(a1, a2, 6 /*ETH_ALEN*/);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue