X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_log.c;h=35c9118e8e558b328a82a50968e5ccbcf43c8c4a;hb=d25dc3518776ed93b2f1e2ca469cf874b24df8b1;hp=ebf0e12445cc9e9e3900a8416c3cedcf6db1a9eb;hpb=6164fe4456716e6dc36aaa2ab617b104a7ac5ff3;p=collectd.git diff --git a/src/write_log.c b/src/write_log.c index ebf0e124..35c9118e 100644 --- a/src/write_log.c +++ b/src/write_log.c @@ -26,55 +26,46 @@ **/ #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 - #include #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 : */