glib-aux: make NMIPAddr a plain union
It is slightly confusing to be required to be aware whether something is a union or a struct. Hence, the union was wrapped in a struct. However, we anyway almost always use the typedef NMIPAddr. The single place where we forward declare the type, we can correctly use the union specifier.
This commit is contained in:
@@ -3,14 +3,12 @@
|
||||
#ifndef __NM_INET_UTILS_H__
|
||||
#define __NM_INET_UTILS_H__
|
||||
|
||||
typedef struct _NMIPAddr {
|
||||
union {
|
||||
guint8 addr_ptr[sizeof(struct in6_addr)];
|
||||
in_addr_t addr4;
|
||||
struct in_addr addr4_struct;
|
||||
struct in6_addr addr6;
|
||||
guint8 array[sizeof(struct in6_addr)];
|
||||
};
|
||||
typedef union _NMIPAddr {
|
||||
guint8 addr_ptr[sizeof(struct in6_addr)];
|
||||
in_addr_t addr4;
|
||||
struct in_addr addr4_struct;
|
||||
struct in6_addr addr6;
|
||||
guint8 array[sizeof(struct in6_addr)];
|
||||
} NMIPAddr;
|
||||
|
||||
#define NM_IP_ADDR_INIT \
|
||||
|
@@ -200,9 +200,9 @@ typedef struct {
|
||||
|
||||
#define NM_ETHER_ADDR_INIT(...) ((NMEtherAddr) _NM_ETHER_ADDR_INIT(__VA_ARGS__))
|
||||
|
||||
struct _NMIPAddr;
|
||||
union _NMIPAddr;
|
||||
|
||||
extern const struct _NMIPAddr nm_ip_addr_zero;
|
||||
extern const union _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. */
|
||||
|
Reference in New Issue
Block a user