resolv: Unify sockaddr union
Merge the following unions into a single union.
sockaddr_union
_sockaddr_union
res_sockaddr_union
Test: netd_{unit,integration}_test pass
Change-Id: I46685e7380dd25070ccd9eaf5387efde91cded8a
diff --git a/resolv/res_send.cpp b/resolv/res_send.cpp
index 1fb8ddd..5a79f28 100644
--- a/resolv/res_send.cpp
+++ b/resolv/res_send.cpp
@@ -148,11 +148,6 @@
static int retrying_poll(const int sock, short events, const struct timespec* finish);
/* BIONIC-BEGIN: implement source port randomization */
-typedef union {
- struct sockaddr sa;
- struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
-} _sockaddr_union;
// BEGIN: Code copied from ISC eventlib
// TODO: move away from this code
@@ -221,7 +216,7 @@
// END: Code copied from ISC eventlib
static int random_bind(int s, int family) {
- _sockaddr_union u;
+ sockaddr_union u;
int j;
socklen_t slen;
@@ -473,7 +468,7 @@
* Note that RES_BLAST overrides RES_ROTATE.
*/
if ((statp->options & RES_ROTATE) != 0U && (statp->options & RES_BLAST) == 0U) {
- union res_sockaddr_union inu;
+ sockaddr_union inu;
struct sockaddr_in ina;
int lastns = statp->nscount - 1;
int fd;