glib-aux: drop unused union field NMIPAddr.array
There is already "addr_ptr" with the same purpose.
This commit is contained in:
@@ -10471,7 +10471,7 @@ test_nm_ip_addr_zero(void)
|
|||||||
g_assert_cmpstr(nm_inet_ntop(AF_INET, &nm_ip_addr_zero, buf), ==, "0.0.0.0");
|
g_assert_cmpstr(nm_inet_ntop(AF_INET, &nm_ip_addr_zero, buf), ==, "0.0.0.0");
|
||||||
g_assert_cmpstr(nm_inet_ntop(AF_INET6, &nm_ip_addr_zero, buf), ==, "::");
|
g_assert_cmpstr(nm_inet_ntop(AF_INET6, &nm_ip_addr_zero, buf), ==, "::");
|
||||||
|
|
||||||
G_STATIC_ASSERT_EXPR(sizeof(a) == sizeof(a.array));
|
G_STATIC_ASSERT_EXPR(sizeof(a) == sizeof(a.addr_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -8,12 +8,11 @@ typedef union _NMIPAddr {
|
|||||||
in_addr_t addr4;
|
in_addr_t addr4;
|
||||||
struct in_addr addr4_struct;
|
struct in_addr addr4_struct;
|
||||||
struct in6_addr addr6;
|
struct in6_addr addr6;
|
||||||
guint8 array[sizeof(struct in6_addr)];
|
|
||||||
} NMIPAddr;
|
} NMIPAddr;
|
||||||
|
|
||||||
#define NM_IP_ADDR_INIT \
|
#define NM_IP_ADDR_INIT \
|
||||||
{ \
|
{ \
|
||||||
.array = { 0 } \
|
.addr_ptr = { 0 } \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _NM_IN6ADDR_INIT(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af) \
|
#define _NM_IN6ADDR_INIT(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af) \
|
||||||
@@ -108,7 +107,7 @@ nm_ip_addr_init(int addr_family, gconstpointer src)
|
|||||||
|
|
||||||
/* ensure all bytes of the union are initialized. If only to make
|
/* ensure all bytes of the union are initialized. If only to make
|
||||||
* valgrind happy. */
|
* valgrind happy. */
|
||||||
memset(&a.array[sizeof(in_addr_t)], 0, sizeof(a) - sizeof(in_addr_t));
|
memset(&a.addr_ptr[sizeof(in_addr_t)], 0, sizeof(a) - sizeof(in_addr_t));
|
||||||
} else
|
} else
|
||||||
memcpy(&a, src, sizeof(struct in6_addr));
|
memcpy(&a, src, sizeof(struct in6_addr));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user