From 92433e596b7fbfa5c75926705dcfef0080ebf012 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 17 Oct 2007 16:58:32 +0000 Subject: [PATCH] We use this ZERO_NULL to avoid picky compiler warnings, when assigning a NULL pointer to a function pointer var. --- lib/dict.c | 18 +++++++++--------- lib/file.c | 16 ++++++++-------- lib/ftp.c | 32 ++++++++++++++++---------------- lib/http.c | 24 ++++++++++++------------ lib/ldap.c | 36 ++++++++++++++++++------------------ lib/setup_once.h | 9 +++++++++ lib/ssh.c | 20 ++++++++++---------- lib/telnet.c | 16 ++++++++-------- lib/tftp.c | 12 ++++++------ lib/url.c | 28 ++++++++++------------------ tests/libtest/lib509.c | 7 ------- 11 files changed, 106 insertions(+), 112 deletions(-) diff --git a/lib/dict.c b/lib/dict.c index 8266e2bb6..f0efab373 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -95,16 +95,16 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done); const struct Curl_handler Curl_handler_dict = { "DICT", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_dict, /* do_it */ - NULL, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_DICT, /* defport */ PROT_DICT /* protocol */ }; diff --git a/lib/file.c b/lib/file.c index d8a3420c0..6d4ae9892 100644 --- a/lib/file.c +++ b/lib/file.c @@ -104,16 +104,16 @@ static CURLcode Curl_file_done(struct connectdata *conn, const struct Curl_handler Curl_handler_file = { "FILE", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_file, /* do_it */ Curl_file_done, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ 0, /* defport */ PROT_FILE /* protocol */ }; diff --git a/lib/ftp.c b/lib/ftp.c index 1cdf23cdb..105830a2c 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -207,16 +207,16 @@ const struct Curl_handler Curl_handler_ftps = { const struct Curl_handler Curl_handler_ftp_proxy = { "FTP", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_FTP, /* defport */ PROT_HTTP /* protocol */ }; @@ -229,16 +229,16 @@ const struct Curl_handler Curl_handler_ftp_proxy = { const struct Curl_handler Curl_handler_ftps_proxy = { "FTPS", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_FTPS, /* defport */ PROT_HTTP /* protocol */ }; diff --git a/lib/http.c b/lib/http.c index d3954338f..b32ca1d5b 100644 --- a/lib/http.c +++ b/lib/http.c @@ -121,16 +121,16 @@ static int Curl_https_getsock(struct connectdata *conn, */ const struct Curl_handler Curl_handler_http = { "HTTP", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ - NULL, /* do_more */ + ZERO_NULL, /* do_more */ Curl_http_connect, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_HTTP, /* defport */ PROT_HTTP, /* protocol */ }; @@ -141,16 +141,16 @@ const struct Curl_handler Curl_handler_http = { */ const struct Curl_handler Curl_handler_https = { "HTTPS", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ - NULL, /* do_more */ + ZERO_NULL, /* do_more */ Curl_http_connect, /* connect_it */ Curl_https_connecting, /* connecting */ - NULL, /* doing */ + ZERO_NULL, /* doing */ Curl_https_getsock, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_HTTPS, /* defport */ PROT_HTTP | PROT_HTTPS | PROT_SSL /* protocol */ }; diff --git a/lib/ldap.c b/lib/ldap.c index e9467e009..57023a952 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -126,16 +126,16 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done); const struct Curl_handler Curl_handler_ldap = { "LDAP", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_ldap, /* do_it */ - NULL, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_LDAP, /* defport */ PROT_LDAP /* protocol */ }; @@ -147,16 +147,16 @@ const struct Curl_handler Curl_handler_ldap = { const struct Curl_handler Curl_handler_ldaps = { "LDAPS", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_ldap, /* do_it */ - NULL, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_LDAPS, /* defport */ PROT_LDAP | PROT_SSL /* protocol */ }; diff --git a/lib/setup_once.h b/lib/setup_once.h index 1622f0cc8..ba564120a 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -378,6 +378,14 @@ typedef int sig_atomic_t; #endif +/* + * We use this ZERO_NULL to avoid picky compiler warnings, + * when assigning a NULL pointer to a function pointer var. + */ + +#define ZERO_NULL 0 + + #if defined (__LP64__) && defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED) #include /* HP-UX has this oddity where it features a few functions that don't work @@ -460,5 +468,6 @@ inline static ssize_t Curl_hp_recvfrom(int s, void *buf, size_t len, int flags, #endif /* HPUX work-around */ + #endif /* __SETUP_ONCE_H */ diff --git a/lib/ssh.c b/lib/ssh.c index 9d5e71e1c..25500a101 100644 --- a/lib/ssh.c +++ b/lib/ssh.c @@ -155,16 +155,16 @@ static CURLcode Curl_sftp_doing(struct connectdata *conn, const struct Curl_handler Curl_handler_scp = { "SCP", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_scp_do, /* do_it */ Curl_scp_done, /* done */ - NULL, /* do_more */ + ZERO_NULL, /* do_more */ Curl_ssh_connect, /* connect_it */ Curl_ssh_multi_statemach, /* connecting */ Curl_scp_doing, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_SSH, /* defport */ PROT_SCP /* protocol */ }; @@ -176,16 +176,16 @@ const struct Curl_handler Curl_handler_scp = { const struct Curl_handler Curl_handler_sftp = { "SFTP", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_sftp_do, /* do_it */ Curl_sftp_done, /* done */ - NULL, /* do_more */ + ZERO_NULL, /* do_more */ Curl_ssh_connect, /* connect_it */ Curl_ssh_multi_statemach, /* connecting */ Curl_sftp_doing, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_SSH, /* defport */ PROT_SFTP /* protocol */ }; diff --git a/lib/telnet.c b/lib/telnet.c index b7c470125..03d5e4df0 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -181,16 +181,16 @@ struct TELNET { const struct Curl_handler Curl_handler_telnet = { "TELNET", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_telnet, /* do_it */ Curl_telnet_done, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_TELNET, /* defport */ PROT_TELNET /* protocol */ }; diff --git a/lib/tftp.c b/lib/tftp.c index 81cd938c5..ba7842280 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -167,13 +167,13 @@ const struct Curl_handler Curl_handler_tftp = { Curl_tftp_setup_connection, /* setup_connection */ Curl_tftp, /* do_it */ Curl_tftp_done, /* done */ - NULL, /* do_more */ + ZERO_NULL, /* do_more */ Curl_tftp_connect, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_TFTP, /* defport */ PROT_TFTP /* protocol */ }; diff --git a/lib/url.c b/lib/url.c index e605fdcd0..eab1d6d55 100644 --- a/lib/url.c +++ b/lib/url.c @@ -175,14 +175,6 @@ static void flush_cookies(struct SessionHandle *data, int cleanup); #define MAX_PIPELINE_LENGTH 5 -/* - * We use this ZERO_NULL to avoid picky compiler warnings, - * when assigning a NULL pointer to a function pointer var. - */ - -#define ZERO_NULL 0 - - #ifndef USE_ARES /* not for ares builds */ @@ -268,16 +260,16 @@ static const struct Curl_handler * const protocols[] = { static const struct Curl_handler Curl_handler_dummy = { "", /* scheme */ - NULL, /* setup_connection */ - NULL, /* do_it */ - NULL, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* setup_connection */ + ZERO_NULL, /* do_it */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ 0, /* defport */ 0 /* protocol */ }; diff --git a/tests/libtest/lib509.c b/tests/libtest/lib509.c index f4dadce73..5d8edd266 100644 --- a/tests/libtest/lib509.c +++ b/tests/libtest/lib509.c @@ -35,13 +35,6 @@ #define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 -/* - * We use this ZERO_NULL to avoid picky compiler warnings, - * when assigning a NULL pointer to a function pointer var. - */ - -#define ZERO_NULL 0 - int portnum; /* the HTTPS port number we use */ typedef struct sslctxparm_st {