X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fxencpu.c;h=8f177803ad8bd802be743c616b3d46a114d2f1f3;hb=1fff3468b0f07d6200496018da6a99795db13337;hp=bf1786477eeebf2342025034fd92560878953002;hpb=9655d4a6d9fa2c4f02032759b831e93933d68bd9;p=collectd.git diff --git a/src/xencpu.c b/src/xencpu.c index bf178647..8f177803 100644 --- a/src/xencpu.c +++ b/src/xencpu.c @@ -56,7 +56,7 @@ static int xencpu_init(void) { xc_physinfo_t *physinfo; - physinfo = calloc(1, sizeof(xc_physinfo_t)); + physinfo = calloc(1, sizeof(*physinfo)); if (physinfo == NULL) { ERROR("xencpu plugin: calloc() for physinfo failed."); xc_interface_close(xc_handle); @@ -75,14 +75,14 @@ static int xencpu_init(void) { INFO("xencpu plugin: Found %" PRIu32 " processors.", num_cpus); - cpu_info = calloc(num_cpus, sizeof(xc_cpuinfo_t)); + cpu_info = calloc(num_cpus, sizeof(*cpu_info)); if (cpu_info == NULL) { ERROR("xencpu plugin: calloc() for num_cpus failed."); xc_interface_close(xc_handle); return ENOMEM; } - cpu_states = calloc(num_cpus, sizeof(value_to_rate_state_t)); + cpu_states = calloc(num_cpus, sizeof(*cpu_states)); if (cpu_states == NULL) { ERROR("xencpu plugin: calloc() for cpu_states failed."); xc_interface_close(xc_handle); @@ -112,7 +112,7 @@ static void submit_value(int cpu_num, gauge_t value) { sstrncpy(vl.type_instance, "load", sizeof(vl.type_instance)); if (cpu_num >= 0) { - ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", cpu_num); + snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", cpu_num); } plugin_dispatch_values(&vl); } /* static void submit_value */