Merge pull request #1830 from rubenk/move-collectd-header
[collectd.git] / src / daemon / common.c
index 9da4775..ff2e519 100644 (file)
@@ -32,6 +32,7 @@
 #endif
 
 #include "collectd.h"
+
 #include "common.h"
 #include "plugin.h"
 #include "utils_cache.h"
@@ -1518,15 +1519,15 @@ int service_name_to_port_number (const char *service_name)
 {
        struct addrinfo *ai_list;
        struct addrinfo *ai_ptr;
-       struct addrinfo ai_hints = { 0 };
        int status;
        int service_number;
 
        if (service_name == NULL)
                return (-1);
 
-       ai_list = NULL;
-       ai_hints.ai_family = AF_UNSPEC;
+       struct addrinfo ai_hints = {
+               .ai_family = AF_UNSPEC
+       };
 
        status = getaddrinfo (/* node = */ NULL, service_name,
                        &ai_hints, &ai_list);