Merge branch 'collectd-5.7' into collectd-5.8
[collectd.git] / src / wireless.c
index 80cd994..5552be6 100644 (file)
@@ -47,20 +47,16 @@ static double wireless_dbm_to_watt (double dbm)
 
        watt = pow (10.0, (dbm / 10.0)) / 1000.0;
 
-       return (watt);
+       return watt;
 }
 #endif
 
 static void wireless_submit(const char *plugin_instance, const char *type,
                             double value) {
-  value_t values[1];
   value_list_t vl = VALUE_LIST_INIT;
 
-  values[0].gauge = value;
-
-  vl.values = values;
+  vl.values = &(value_t){.gauge = value};
   vl.values_len = 1;
-  sstrncpy(vl.host, hostname_g, sizeof(vl.host));
   sstrncpy(vl.plugin, "wireless", sizeof(vl.plugin));
   sstrncpy(vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance));
   sstrncpy(vl.type, type, sizeof(vl.type));
@@ -73,7 +69,7 @@ static void wireless_submit(const char *plugin_instance, const char *type,
 static double wireless_percent_to_power(double quality) {
   assert((quality >= 0.0) && (quality <= 100.0));
 
-  return ((quality * (POWER_MAX - POWER_MIN)) + POWER_MIN);
+  return (quality * (POWER_MAX - POWER_MIN)) + POWER_MIN;
 } /* double wireless_percent_to_power */
 
 static int wireless_read(void) {
@@ -96,7 +92,7 @@ static int wireless_read(void) {
   if ((fh = fopen(WIRELESS_PROC_FILE, "r")) == NULL) {
     char errbuf[1024];
     WARNING("wireless: fopen: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
-    return (-1);
+    return -1;
   }
 
   devices_found = 0;
@@ -155,10 +151,10 @@ static int wireless_read(void) {
   /* If no wireless devices are present return an error, so the plugin
    * code delays our read function. */
   if (devices_found == 0)
-    return (-1);
+    return -1;
 #endif /* KERNEL_LINUX */
 
-  return (0);
+  return 0;
 } /* int wireless_read */
 
 void module_register(void) {