Merge branch 'collectd-5.5' into collectd-5.6
[collectd.git] / src / write_log.c
index e37aae9..35c9118 100644 (file)
  **/
 
 #include "collectd.h"
+
 #include "common.h"
 #include "plugin.h"
-#include "configfile.h"
 
 #include "utils_format_graphite.h"
 
-/* Folks without pthread will need to disable this plugin. */
-#include <pthread.h>
-
-#include <sys/socket.h>
 #include <netdb.h>
 
 #define WL_BUF_SIZE 8192
 
-static int wl_write_messages (const data_set_t *ds, const value_list_t *vl)
-{
-    char buffer[WL_BUF_SIZE];
-    int status;
+static int wl_write_messages(const data_set_t *ds, const value_list_t *vl) {
+  char buffer[WL_BUF_SIZE] = {0};
+  int status;
 
-    if (0 != strcmp (ds->type, vl->type))
-    {
-        ERROR ("write_log plugin: DS type does not match "
-                "value list type");
-        return -1;
-    }
+  if (0 != strcmp(ds->type, vl->type)) {
+    ERROR("write_log plugin: DS type does not match "
+          "value list type");
+    return -1;
+  }
 
-    memset (buffer, 0, sizeof (buffer));
-    status = format_graphite (buffer, sizeof (buffer), ds, vl,
-                              NULL, NULL, '_', 0);
-    if (status != 0) /* error message has been printed already. */
-        return (status);
+  status = format_graphite(buffer, sizeof(buffer), ds, vl, NULL, NULL, '_', 0);
+  if (status != 0) /* error message has been printed already. */
+    return (status);
 
-    INFO ("write_log values:\n%s", buffer);
+  INFO("write_log values:\n%s", buffer);
 
-    return (0);
+  return (0);
 } /* int wl_write_messages */
 
-static int wl_write (const data_set_t *ds, const value_list_t *vl,
-        user_data_t *user_data)
-{
-    int status;
+static int wl_write(const data_set_t *ds, const value_list_t *vl,
+                    __attribute__((unused)) user_data_t *user_data) {
+  int status;
 
-    status = wl_write_messages (ds, vl);
+  status = wl_write_messages(ds, vl);
 
-    return (status);
+  return (status);
 }
 
-void module_register (void)
-{
-    plugin_register_write ("write_log", wl_write, NULL);
+void module_register(void) {
+  plugin_register_write("write_log", wl_write, NULL);
 }
 
 /* vim: set sw=4 ts=4 sts=4 tw=78 et : */