Format BSD constrained sysctl usage
[collectd.git] / src / uuid.c
index 1cb9027..a5fba03 100644 (file)
 
 #include "collectd.h"
 
-#include "common.h"
 #include "plugin.h"
+#include "utils/common/common.h"
 
-#if HAVE_SYS_SYSCTL_H
+#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME) ||                \
+    defined(__OpenBSD__)
+/* Implies have BSD variant */
 #include <sys/sysctl.h>
 #endif
 
 #define UUID_PRINTABLE_COMPACT_LENGTH (UUID_RAW_LENGTH * 2)
 #define UUID_PRINTABLE_NORMAL_LENGTH (UUID_PRINTABLE_COMPACT_LENGTH + 4)
 
-static char *uuidfile = NULL;
+static char *uuidfile;
 
 static const char *config_keys[] = {"UUIDFile"};
 
 static int looks_like_a_uuid(const char *uuid) {
-  int len;
-
   if (!uuid)
     return 0;
 
-  len = strlen(uuid);
-
+  size_t len = strlen(uuid);
   if (len < UUID_PRINTABLE_COMPACT_LENGTH)
     return 0;