1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

sockaddr.h: Fixed dereferencing pointer breakin strict-aliasing

Fixed warning: dereferencing pointer does break strict-aliasing rules
by using a union inside the struct Curl_sockaddr_storage declaration.
This commit is contained in:
Marc Hoersken 2012-06-26 07:27:02 +02:00 committed by Yang Tse
parent 849179ba27
commit a8478fc8d3

View File

@ -24,14 +24,19 @@
#include "setup.h"
#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
struct Curl_sockaddr_storage {
struct sockaddr_storage buffer;
};
#else
struct Curl_sockaddr_storage {
char buffer[256]; /* this should be big enough to fit a lot */
};
union {
struct sockaddr sa;
struct sockaddr_in sa_in;
#ifdef ENABLE_IPV6
struct sockaddr_in6 sa_in6;
#endif
#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
struct sockaddr_storage sa_stor;
#else
char cbuf[256]; /* this should be big enough to fit a lot */
#endif
} buffer;
};
#endif /* __SOCKADDR_H */