]> granicus.if.org Git - curl/commitdiff
We use this ZERO_NULL to avoid picky compiler warnings,
authorYang Tse <yangsita@gmail.com>
Wed, 17 Oct 2007 16:58:32 +0000 (16:58 +0000)
committerYang Tse <yangsita@gmail.com>
Wed, 17 Oct 2007 16:58:32 +0000 (16:58 +0000)
when assigning a NULL pointer to a function pointer var.

lib/dict.c
lib/file.c
lib/ftp.c
lib/http.c
lib/ldap.c
lib/setup_once.h
lib/ssh.c
lib/telnet.c
lib/tftp.c
lib/url.c
tests/libtest/lib509.c

index 8266e2bb6c29a892e74db641a048a6105ba5b5bc..f0efab3735fc50e4e64ae1d49feff768956d3f11 100644 (file)
@@ -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 */
 };
index d8a3420c076f68d4e78569b3a5f4e94f87e6ea6a..6d4ae989217a0f1a54677b9ff44c6b8e9ed0b1ff 100644 (file)
@@ -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 */
 };
index 1cdf23cdbe8b5a1ab1b2d127098e29ec43d82c0f..105830a2c8583dbe9fa5be6ba0be539575e0b2e2 100644 (file)
--- 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 */
 };
index d3954338f21eb9285405703fde57a00d558668c3..b32ca1d5bc7b29af76577f8b1d1a0af7c65d48f8 100644 (file)
@@ -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 */
 };
index e9467e0097be5de2e005a564e10413ee7890c586..57023a9525ee4da90628fbb4092f0e4ec70faeea 100644 (file)
@@ -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 */
 };
index 1622f0cc85c976370f4dfa4544570593d3514e8d..ba564120a06ef21c4f21527fbedb5f5529d71346 100644 (file)
@@ -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 <sys/socket.h>
 /* 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 */
 
index 9d5e71e1ce125c823494d245e92921d90d30731c..25500a101aec65489ab698fc2dfda5db539d5bd4 100644 (file)
--- 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 */
 };
index b7c4701258b5be3d7773b5c09e251f2378008036..03d5e4df05de813e06b823b8caf34a99b51e136d 100644 (file)
@@ -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 */
 };
index 81cd938c53f3df2858a2b94747f8b3b9d3724ad6..ba78422800bc83346af9556d40b81efccb5a716c 100644 (file)
@@ -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 */
 };
index e605fdcd0207a0008f905c8e5841746931fddaff..eab1d6d55e8395950d70f598d7f8d01078901f8d 100644 (file)
--- 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 = {
   "<no protocol>",                      /* 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 */
 };
index f4dadce73368603f303083004b197ddd21f28a93..5d8edd266c614cacd118b18408abf5cfc7443cb7 100644 (file)
 #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 {