diff --git a/doc/Changelog b/doc/Changelog index 6a51e317e..2f289cae4 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,7 @@ null delete for wsaevent. - Fix spelling in freebind option man page text. - Fix windows link of ssl with crypt32. + - Fix 779: Union casting is non-portable. 13 June 2016: Ralph - Use QTYPE=A for QNAME minimisation. diff --git a/util/ub_event.c b/util/ub_event.c index af2a18ea0..ebf9029e7 100644 --- a/util/ub_event.c +++ b/util/ub_event.c @@ -132,14 +132,10 @@ static void (*NATIVE_BITS_CB(void (*cb)(int, short, void*)))(int, short, void*) #define EVFLAG_AUTO 0 #endif -#define AS_EVENT_BASE(x) \ - (((union {struct ub_event_base* a; struct event_base* b;})x).b) -#define AS_UB_EVENT_BASE(x) \ - (((union {struct event_base* a; struct ub_event_base* b;})x).b) -#define AS_EVENT(x) \ - (((union {struct ub_event* a; struct event* b;})x).b) -#define AS_UB_EVENT(x) \ - (((union {struct event* a; struct ub_event* b;})x).b) +#define AS_EVENT_BASE(x) ((struct event_base*)x) +#define AS_UB_EVENT_BASE(x) ((struct ub_event_base*)x) +#define AS_EVENT(x) ((struct event*)x) +#define AS_UB_EVENT(x) ((struct ub_event*)x) const char* ub_event_get_version() { diff --git a/util/ub_event_pluggable.c b/util/ub_event_pluggable.c index f8a4b9a6f..c30880a54 100644 --- a/util/ub_event_pluggable.c +++ b/util/ub_event_pluggable.c @@ -144,10 +144,8 @@ struct my_event { struct event ev; }; -#define AS_MY_EVENT_BASE(x) \ - (((union {struct ub_event_base* a; struct my_event_base* b;})x).b) -#define AS_MY_EVENT(x) \ - (((union {struct ub_event* a; struct my_event* b;})x).b) +#define AS_MY_EVENT_BASE(x) ((struct my_event_base*)x) +#define AS_MY_EVENT(x) ((struct my_event*)x) const char* ub_event_get_version() {