X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ftape.c;h=8ec9bf28dcefc303a8e0cbf8495341b46cb508c6;hb=e1bfa71aca1f37c2f293dc9adb44065c6e7a9ad9;hp=a8e7dc45faab08bdf18ffd42fbebd242f3f3477f;hpb=7a762196fa7a4024c19ceac9b0c6918a5d8f62d5;p=collectd.git diff --git a/src/tape.c b/src/tape.c index a8e7dc45..8ec9bf28 100644 --- a/src/tape.c +++ b/src/tape.c @@ -21,6 +21,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" @@ -60,14 +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; + vl.values_len = STATIC_ARRAY_SIZE (values); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "tape", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, @@ -98,7 +99,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); @@ -106,7 +106,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;