diff options
author | Brad King <brad.king@kitware.com> | 2003-08-27 21:31:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2003-08-27 21:31:22 (GMT) |
commit | 9f8444d7f60e8cc99a0516de0d03a98dd73f8991 (patch) | |
tree | 666bff4cf3c317ae44356f60561e2db791c8a4ba /Source/CTest | |
parent | a35d911defc912e3d5f1cbbf292493cbcec6f238 (diff) | |
download | CMake-9f8444d7f60e8cc99a0516de0d03a98dd73f8991.zip CMake-9f8444d7f60e8cc99a0516de0d03a98dd73f8991.tar.gz CMake-9f8444d7f60e8cc99a0516de0d03a98dd73f8991.tar.bz2 |
ERR: Using union-based "cast" of DynaGetFunction result to avoid warnings about strict aliasing.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/Curl/ldap.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Source/CTest/Curl/ldap.c b/Source/CTest/Curl/ldap.c index fb4bb79..3cb28fb 100644 --- a/Source/CTest/Curl/ldap.c +++ b/Source/CTest/Curl/ldap.c @@ -53,14 +53,14 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> - -#define DYNA_GET_FUNCTION(type, fnc) \ - { \ - void* dyna_get_res = DynaGetFunction(#fnc); \ - (fnc) = *((type)&dyna_get_res); \ - if ((fnc) == NULL) { \ - return CURLE_FUNCTION_NOT_FOUND; \ - } \ +#define DYNA_GET_FUNCTION(type, fnc) \ + { \ + union { void* ptr; type; } u; \ + u.ptr = DynaGetFunction(#fnc); \ + (fnc) = u.fptr; \ + if ((fnc) == NULL) { \ + return CURLE_FUNCTION_NOT_FOUND; \ + } \ } /*********************************************************************** @@ -166,15 +166,15 @@ CURLcode Curl_ldap(struct connectdata *conn) /* The types are needed because ANSI C distinguishes between * pointer-to-object (data) and pointer-to-function. */ - DYNA_GET_FUNCTION(void *(**)(char *, int), ldap_open); - DYNA_GET_FUNCTION(int (**)(void *, char *, char *), ldap_simple_bind_s); - DYNA_GET_FUNCTION(int (**)(void *), ldap_unbind_s); - DYNA_GET_FUNCTION(int (**)(void *, char *, int, void **), ldap_url_search_s); - DYNA_GET_FUNCTION(void *(**)(void *, void *), ldap_first_entry); - DYNA_GET_FUNCTION(void *(**)(void *, void *), ldap_next_entry); - DYNA_GET_FUNCTION(char *(**)(int), ldap_err2string); - DYNA_GET_FUNCTION(int (**)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long), ldap_entry2text); - DYNA_GET_FUNCTION(int (**)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long, char *, char *), ldap_entry2html); + DYNA_GET_FUNCTION(void *(*fptr)(char *, int), ldap_open); + DYNA_GET_FUNCTION(int (*fptr)(void *, char *, char *), ldap_simple_bind_s); + DYNA_GET_FUNCTION(int (*fptr)(void *), ldap_unbind_s); + DYNA_GET_FUNCTION(int (*fptr)(void *, char *, int, void **), ldap_url_search_s); + DYNA_GET_FUNCTION(void *(*fptr)(void *, void *), ldap_first_entry); + DYNA_GET_FUNCTION(void *(*fptr)(void *, void *), ldap_next_entry); + DYNA_GET_FUNCTION(char *(*fptr)(int), ldap_err2string); + DYNA_GET_FUNCTION(int (*fptr)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long), ldap_entry2text); + DYNA_GET_FUNCTION(int (*fptr)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long, char *, char *), ldap_entry2html); server = ldap_open(conn->hostname, conn->port); if (server == NULL) { |