Commit ba481718 authored by Yang Tse's avatar Yang Tse
Browse files

Make more human readable and maintainable previous

compiler warning fix since it was Ok and actually
avoids the targeted compiler warning.
parent 1be60dde
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -115,6 +115,13 @@
#undef HAVE_LIBDL
#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

typedef void * (*dynafunc)(void *input);

/***********************************************************************
@@ -189,7 +196,7 @@ static void DynaClose(void)

static dynafunc DynaGetFunction(const char *name)
{
  dynafunc func = (void *(*)(void *))0;
  dynafunc func = (dynafunc)ZERO_NULL;

#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
  if (libldap) {
+14 −7
Original line number Diff line number Diff line
@@ -165,6 +165,13 @@ static void signalPipeClose(struct curl_llist *pipe);

#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 */

@@ -501,9 +508,9 @@ CURLcode Curl_open(struct SessionHandle **curl)
    data->set.fread = (curl_read_callback)fread;

    /* conversion callbacks for non-ASCII hosts */
    data->set.convfromnetwork = (CURLcode(*)(char *, size_t))0;
    data->set.convtonetwork   = (CURLcode(*)(char *, size_t))0;
    data->set.convfromutf8    = (CURLcode(*)(char *, size_t))0;
    data->set.convfromnetwork = (curl_conv_callback)ZERO_NULL;
    data->set.convtonetwork   = (curl_conv_callback)ZERO_NULL;
    data->set.convfromutf8    = (curl_conv_callback)ZERO_NULL;

#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
    /* conversion descriptors for iconv calls */
@@ -2993,7 +3000,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
    conn->remote_port = PORT_HTTP;
    conn->protocol |= PROT_HTTP;
    conn->curl_do = Curl_http;
    conn->curl_do_more = (CURLcode(*)(struct connectdata *))0;
    conn->curl_do_more = (Curl_do_more_func)ZERO_NULL;
    conn->curl_done = Curl_http_done;
    conn->curl_connect = Curl_http_connect;
#else
@@ -3010,7 +3017,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
    conn->protocol |= PROT_HTTP|PROT_HTTPS|PROT_SSL;

    conn->curl_do = Curl_http;
    conn->curl_do_more = (CURLcode(*)(struct connectdata *))0;
    conn->curl_do_more = (Curl_do_more_func)ZERO_NULL;
    conn->curl_done = Curl_http_done;
    conn->curl_connect = Curl_http_connect;
    conn->curl_connecting = Curl_https_connecting;
@@ -3124,7 +3131,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
    conn->remote_port = PORT_DICT;
    conn->curl_do = Curl_dict;
    /* no DICT-specific done */
    conn->curl_done = (CURLcode(*)(struct connectdata *, CURLcode))0;
    conn->curl_done = (Curl_done_func)ZERO_NULL;
#else
    failf(data, LIBCURL_NAME
          " was built with DICT disabled!");
@@ -3137,7 +3144,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
    conn->remote_port = PORT_LDAP;
    conn->curl_do = Curl_ldap;
    /* no LDAP-specific done */
    conn->curl_done = (CURLcode(*)(struct connectdata *, CURLcode))0;
    conn->curl_done = (Curl_done_func)ZERO_NULL;
#else
    failf(data, LIBCURL_NAME
          " was built with LDAP disabled!");