X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcpu.c;h=36c49720f1bcf464f33a2e653236d80c64f5dcd5;hb=d425636110c5fb146d1f6205e2749218f3c31076;hp=105c8ecc42a631a8fadc6d3ef77df3af033d20af;hpb=1d6c7b046100cbae92df62aa7e50dcf101fa9867;p=collectd.git diff --git a/src/cpu.c b/src/cpu.c index 105c8ecc..36c49720 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -336,7 +336,6 @@ static void submit_value (int cpu_num, int cpu_state, const char *type, value_t vl.values = &value; vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "cpu", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); sstrncpy (vl.type_instance, cpu_state_names[cpu_state], @@ -411,8 +410,7 @@ static int total_rate(gauge_t *sum_by_state, size_t state, derive_t d, value_to_rate_state_t* conv, cdtime_t now) { gauge_t rate = NAN; - value_t val = { .derive = d }; - int status = value_to_rate (&rate, val, DS_TYPE_DERIVE, now, conv); + int status = value_to_rate (&rate, (value_t) { .derive = d }, DS_TYPE_DERIVE, now, conv); if (status != 0) return (status); @@ -455,10 +453,9 @@ static void aggregate (gauge_t *sum_by_state) /* {{{ */ #if defined(HAVE_PERFSTAT) /* {{{ */ cdtime_t now = cdtime (); - perfstat_cpu_total_t cputotal; - memset(&cputotal, 0, sizeof(perfstat_cpu_total_t)); + perfstat_cpu_total_t cputotal = { 0 }; - if (!perfstat_cpu_total(NULL, &cputotal, sizeof(perfstat_cpu_total_t), 1)) { + if (!perfstat_cpu_total(NULL, &cputotal, sizeof(cputotal), 1)) { char errbuf[1024]; WARNING ("cpu plugin: perfstat_cpu_total: %s", sstrerror (errno, errbuf, sizeof (errbuf))); @@ -511,7 +508,6 @@ static void cpu_commit_num_cpu (gauge_t value) /* {{{ */ vl.values = &(value_t) { .gauge = value }; vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "cpu", sizeof (vl.plugin)); sstrncpy (vl.type, "count", sizeof (vl.type));