X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftape.c;h=c7d56c736b4a1d1261b165517aede4b32ae7239a;hb=dc57f6e8f2394b51dd35d1d8231ef110c075b831;hp=723ee7b8b04494ee5da0ac1570f7bfb48216c3c6;hpb=4103105fb43cd72294f165b2541540b3a8a99532;p=collectd.git diff --git a/src/tape.c b/src/tape.c index 723ee7b8..c7d56c73 100644 --- a/src/tape.c +++ b/src/tape.c @@ -61,15 +61,14 @@ static void tape_submit (const char *plugin_instance, const char *type, derive_t read, derive_t write) { - value_t values[2]; value_list_t vl = VALUE_LIST_INIT; - - values[0].derive = read; - values[1].derive = write; + value_t values[] = { + { .derive = read }, + { .derive = write }, + }; vl.values = values; - vl.values_len = 2; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + vl.values_len = STATIC_ARRAY_SIZE (values); sstrncpy (vl.plugin, "tape", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); @@ -99,7 +98,6 @@ static int tape_read (void) # error "kstat_io_t does not have the required members" #endif static kstat_io_t kio; - int i; if (kc == NULL) return (-1); @@ -107,7 +105,7 @@ static int tape_read (void) if (numtape <= 0) return (-1); - for (i = 0; i < numtape; i++) + for (int i = 0; i < numtape; i++) { if (kstat_read (kc, ksp[i], &kio) == -1) continue;