X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fteamspeak2.c;h=a1cde320dd2cb3e9a83f9910da40beb31eefbb43;hb=b55658bb615f6d33e70791d2a7d2a0f2114598cc;hp=cf093c5feec35debf969b27d4c1fac8b432b20ba;hpb=362a519e00d50fc3657d485135075f753ec71bab;p=collectd.git diff --git a/src/teamspeak2.c b/src/teamspeak2.c index cf093c5f..a1cde320 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -22,6 +22,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" @@ -198,9 +199,7 @@ static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh) * Returns connected file objects or establishes the connection * if it's not already present */ - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_head; - struct addrinfo *ai_ptr; int sd = -1; int status; @@ -216,11 +215,11 @@ static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh) } /* Get all addrs for this hostname */ -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_socktype = SOCK_STREAM + }; status = getaddrinfo ((config_host != NULL) ? config_host : DEFAULT_HOST, (config_port != NULL) ? config_port : DEFAULT_PORT, @@ -234,7 +233,7 @@ static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh) } /* Try all given hosts until we can connect to one */ - for (ai_ptr = ai_head; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) + for (struct addrinfo *ai_ptr = ai_head; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) { /* Create socket */ sd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, @@ -770,7 +769,6 @@ static int tss2_read (void) * Poll function which collects global and vserver information * and submits it to collectd */ - vserver_list_t *vserver; int success = 0; int status; @@ -786,7 +784,7 @@ static int tss2_read (void) } /* Handle vservers */ - for (vserver = server_list; vserver != NULL; vserver = vserver->next) + for (vserver_list_t *vserver = server_list; vserver != NULL; vserver = vserver->next) { status = tss2_read_vserver (vserver); if (status == 0)