X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Faquaero.c;h=8872409fcc118c691c4a0a85cdbdf0e14c00fb6b;hb=41288c6a9ed050b41ad47184aa1b53668c3588cc;hp=5db988e60663f56c39c796596176ff587088c046;hpb=72ec1d0ed6cde4aa78f17d031e7a48e37cbf7a57;p=collectd.git diff --git a/src/aquaero.c b/src/aquaero.c index 5db988e6..8872409f 100644 --- a/src/aquaero.c +++ b/src/aquaero.c @@ -20,6 +20,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" @@ -33,9 +34,7 @@ static char *conf_device = NULL; static int aquaero_config (oconfig_item_t *ci) { - int i; - - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; @@ -61,19 +60,15 @@ static void aquaero_submit (const char *type, const char *type_instance, double value) { const char *instance = conf_device?conf_device:"default"; - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; /* Don't report undefined values. */ if (value == AQ5_FLOAT_UNDEF) return; - 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, "aquaero", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, instance, sizeof (vl.plugin_instance)); sstrncpy (vl.type, type, sizeof (vl.type)); @@ -87,9 +82,8 @@ static void aquaero_submit_array (const char *type, const char *type_instance_prefix, double *value_array, int len) { char type_instance[DATA_MAX_NAME_LEN]; - int i; - for (i = 0; i < len; i++) + for (int i = 0; i < len; i++) { if (value_array[i] == AQ5_FLOAT_UNDEF) continue; @@ -106,7 +100,6 @@ static int aquaero_read (void) aq5_settings_t aq_sett; char *err_msg = NULL; char type_instance[DATA_MAX_NAME_LEN]; - int i; if (libaquaero5_poll(conf_device, &aq_data, &err_msg) < 0) { @@ -147,7 +140,7 @@ static int aquaero_read (void) AQ5_NUM_OTHER_SENSORS); /* Fans */ - for (i = 0; i < AQ5_NUM_FAN; i++) + for (int i = 0; i < AQ5_NUM_FAN; i++) { if ((aq_sett.fan_data_source[i] == NONE) || (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF))