Merge branch 'collectd-5.7' into collectd-5.8
[collectd.git] / src / protocols.c
index 393c12d..b63dee9 100644 (file)
@@ -52,19 +52,18 @@ static ignorelist_t *values_list = NULL;
  */
 static void submit(const char *protocol_name, const char *str_key,
                    const char *str_value) {
-  value_t values[1];
+  value_t value;
   value_list_t vl = VALUE_LIST_INIT;
   int status;
 
-  status = parse_value(str_value, values, DS_TYPE_DERIVE);
+  status = parse_value(str_value, &value, DS_TYPE_DERIVE);
   if (status != 0) {
     ERROR("protocols plugin: Parsing string as integer failed: %s", str_value);
     return;
   }
 
-  vl.values = values;
+  vl.values = &value;
   vl.values_len = 1;
-  sstrncpy(vl.host, hostname_g, sizeof(vl.host));
   sstrncpy(vl.plugin, "protocols", sizeof(vl.plugin));
   sstrncpy(vl.plugin_instance, protocol_name, sizeof(vl.plugin_instance));
   sstrncpy(vl.type, "protocol_counter", sizeof(vl.type));
@@ -90,7 +89,7 @@ static int read_file(const char *path) {
   if (fh == NULL) {
     ERROR("protocols plugin: fopen (%s) failed: %s.", path,
           sstrerror(errno, key_buffer, sizeof(key_buffer)));
-    return (-1);
+    return -1;
   }
 
   status = -1;
@@ -157,8 +156,8 @@ static int read_file(const char *path) {
       if (values_list != NULL) {
         char match_name[2 * DATA_MAX_NAME_LEN];
 
-        ssnprintf(match_name, sizeof(match_name), "%s:%s", key_buffer,
-                  key_fields[i]);
+        snprintf(match_name, sizeof(match_name), "%s:%s", key_buffer,
+                 key_fields[i]);
 
         if (ignorelist_match(values_list, match_name))
           continue;
@@ -170,7 +169,7 @@ static int read_file(const char *path) {
 
   fclose(fh);
 
-  return (status);
+  return status;
 } /* int read_file */
 
 static int protocols_read(void) {
@@ -186,9 +185,9 @@ static int protocols_read(void) {
     success++;
 
   if (success == 0)
-    return (-1);
+    return -1;
 
-  return (0);
+  return 0;
 } /* int protocols_read */
 
 static int protocols_config(const char *key, const char *value) {
@@ -203,10 +202,10 @@ static int protocols_config(const char *key, const char *value) {
       invert = 0;
     ignorelist_set_invert(values_list, invert);
   } else {
-    return (-1);
+    return -1;
   }
 
-  return (0);
+  return 0;
 } /* int protocols_config */
 
 void module_register(void) {
@@ -214,5 +213,3 @@ void module_register(void) {
                          config_keys_num);
   plugin_register_read("protocols", protocols_read);
 } /* void module_register */
-
-/* vim: set sw=2 sts=2 et : */