treewide: replace memset to 0 with initializers
[collectd.git] / src / pf.c
index 112e28f..42679fe 100644 (file)
--- a/src/pf.c
+++ b/src/pf.c
@@ -26,9 +26,6 @@
 #if HAVE_SYS_IOCTL_H
 # include <sys/ioctl.h>
 #endif
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
 #if HAVE_NET_IF_H
 # include <net/if.h>
 #endif
@@ -82,7 +79,7 @@ static void pf_submit (char const *type, char const *type_instance,
 
 static int pf_read (void)
 {
-       struct pf_status state;
+       struct pf_status state = { 0 };
        int fd;
        int status;
        int i;
@@ -97,7 +94,6 @@ static int pf_read (void)
                return (-1);
        }
 
-       memset (&state, 0, sizeof (state));
        status = ioctl (fd, DIOCGETSTATUS, &state);
        if (status != 0)
        {
@@ -109,7 +105,6 @@ static int pf_read (void)
        }
 
        close (fd);
-       fd = -1;
 
        if (!state.running)
        {