X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Faquaero.c;h=08271f87a4b4bdf8124676ec4322ee4932bb9cdd;hb=6f4f918d4d5e70c75471632254ecb9c55fd8d62f;hp=5db988e60663f56c39c796596176ff587088c046;hpb=079f487bae003575e360dcd6034546485f69b5c8;p=collectd.git diff --git a/src/aquaero.c b/src/aquaero.c index 5db988e6..08271f87 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,16 +60,13 @@ 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)); @@ -87,9 +83,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 +101,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 +141,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))