From: Ruben Kerkhof Date: Tue, 2 Aug 2016 14:42:23 +0000 (+0200) Subject: no need to initialize result ptr of getaddrinfo X-Git-Tag: collectd-5.6.0~127^2~1 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=5afde1077e3c8fc119b79caa2572cbf84dbfe5ca no need to initialize result ptr of getaddrinfo --- diff --git a/src/daemon/common.c b/src/daemon/common.c index b3bc7532..7bbace76 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -1524,8 +1524,6 @@ int service_name_to_port_number (const char *service_name) if (service_name == NULL) return (-1); - ai_list = NULL; - struct addrinfo ai_hints = { .ai_family = AF_UNSPEC }; diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index fea9360e..cd333cc3 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -471,8 +471,6 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ } } - ai_res = NULL; - struct addrinfo ai_hints = { .ai_family = AF_UNSPEC, .ai_flags = AI_ADDRCONFIG, diff --git a/src/libcollectdclient/network.c b/src/libcollectdclient/network.c index afbee6e8..ee5af3b5 100644 --- a/src/libcollectdclient/network.c +++ b/src/libcollectdclient/network.c @@ -119,7 +119,7 @@ static void int_server_destroy (lcc_server_t *srv) /* {{{ */ static int server_open_socket (lcc_server_t *srv) /* {{{ */ { - struct addrinfo *ai_list = NULL; + struct addrinfo *ai_list; struct addrinfo *ai_ptr; int status; diff --git a/src/memcached.c b/src/memcached.c index c0c9e70c..46155e7e 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -108,8 +108,6 @@ static int memcached_connect_inet (memcached_t *st) host = (st->host != NULL) ? st->host : MEMCACHED_DEF_HOST; port = (st->port != NULL) ? st->port : MEMCACHED_DEF_PORT; - ai_list = NULL; - struct addrinfo ai_hints = { .ai_family = AF_UNSPEC, .ai_flags = AI_ADDRCONFIG, diff --git a/src/modbus.c b/src/modbus.c index a2150600..ec429698 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -823,8 +823,6 @@ static int mb_config_set_host_address (mb_host_t *host, /* {{{ */ if ((host == NULL) || (address == NULL)) return (EINVAL); - ai_list = NULL; - struct addrinfo ai_hints = { /* XXX: libmodbus can only handle IPv4 addresses. */ .ai_family = AF_INET, diff --git a/src/network.c b/src/network.c index 11c39a78..4ce3f5f0 100644 --- a/src/network.c +++ b/src/network.c @@ -2139,7 +2139,7 @@ static int sockent_client_connect (sockent_t *se) /* {{{ */ static c_complain_t complaint = C_COMPLAIN_INIT_STATIC; struct sockent_client *client; - struct addrinfo *ai_list = NULL, *ai_ptr; + struct addrinfo *ai_list, *ai_ptr; int status; _Bool reconnect = 0; cdtime_t now; diff --git a/src/olsrd.c b/src/olsrd.c index 976793fe..ac47811c 100644 --- a/src/olsrd.c +++ b/src/olsrd.c @@ -154,8 +154,6 @@ static FILE *olsrd_connect (void) /* {{{ */ FILE *fh; - ai_list = NULL; - struct addrinfo ai_hints = { .ai_family = PF_UNSPEC, .ai_flags = AI_ADDRCONFIG, diff --git a/src/pinba.c b/src/pinba.c index 6a4ebfcd..66170bf7 100644 --- a/src/pinba.c +++ b/src/pinba.c @@ -360,8 +360,6 @@ static pinba_socket_t *pinba_socket_open (const char *node, /* {{{ */ if (service == NULL) service = PINBA_DEFAULT_SERVICE; - ai_list = NULL; - struct addrinfo ai_hints = { .ai_family = AF_UNSPEC, .ai_flags = AI_PASSIVE, diff --git a/src/statsd.c b/src/statsd.c index 285486d8..8acd9fd2 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -500,7 +500,7 @@ static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */ struct pollfd *fds = NULL; size_t fds_num = 0; - struct addrinfo *ai_list = NULL; + struct addrinfo *ai_list; struct addrinfo *ai_ptr; int status; diff --git a/src/write_graphite.c b/src/write_graphite.c index efdd4d8a..f890b971 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -220,8 +220,6 @@ static int wg_callback_init (struct wg_callback *cb) else ai_hints.ai_socktype = SOCK_DGRAM; - ai_list = NULL; - status = getaddrinfo (cb->node, cb->service, &ai_hints, &ai_list); if (status != 0) { diff --git a/src/write_tsdb.c b/src/write_tsdb.c index fe418cf9..401e8753 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -165,8 +165,6 @@ static int wt_callback_init(struct wt_callback *cb) if (cb->sock_fd > 0) return 0; - ai_list = NULL; - struct addrinfo ai_hints = { .ai_family = AF_UNSPEC, .ai_flags = AI_ADDRCONFIG,