X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcontextswitch.c;h=461fb0a9da502b808348e14f32360fe19cce854c;hb=0d9f395599348e735e6f461e1c328293bef0d060;hp=d91c0738fd0c77825a3e91b5c7a73755a9cea7de;hpb=79963d13c1884d1d92667cc502ad20758b084a12;p=collectd.git diff --git a/src/contextswitch.c b/src/contextswitch.c index d91c0738..461fb0a9 100644 --- a/src/contextswitch.c +++ b/src/contextswitch.c @@ -48,14 +48,10 @@ #endif static void cs_submit(derive_t context_switches) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].derive = (derive_t)context_switches; - - vl.values = values; + vl.values = &(value_t){.derive = context_switches}; vl.values_len = 1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "contextswitch", sizeof(vl.plugin)); sstrncpy(vl.type, "contextswitch", sizeof(vl.type)); @@ -73,7 +69,7 @@ static int cs_read(void) { if (status != 0) { ERROR("contextswitch plugin: sysctlbyname " "(vm.stats.sys.v_swtch) failed"); - return (-1); + return -1; } cs_submit(value); @@ -91,7 +87,7 @@ static int cs_read(void) { if (fh == NULL) { ERROR("contextswitch plugin: unable to open /proc/stat: %s", sstrerror(errno, buffer, sizeof(buffer))); - return (-1); + return -1; } while (fgets(buffer, sizeof(buffer), fh) != NULL) { @@ -133,7 +129,7 @@ static int cs_read(void) { char errbuf[1024]; ERROR("contextswitch plugin: perfstat_cpu_total: %s", sstrerror(errno, errbuf, sizeof(errbuf))); - return (-1); + return -1; } cs_submit(perfcputotal.pswitch);