#include "collectd.h"
-#include "common.h"
#include "plugin.h"
-#include "utils_ignorelist.h"
+#include "utils/common/common.h"
+#include "utils/ignorelist/ignorelist.h"
#if HAVE_MACH_MACH_TYPES_H
#include <mach/mach_types.h>
break;
if (ds == NULL) {
- if ((ds = (diskstats_t *)calloc(1, sizeof(diskstats_t))) == NULL)
+ if ((ds = calloc(1, sizeof(*ds))) == NULL)
continue;
if ((ds->name = strdup(disk_name)) == NULL) {
ds->poll_count = poll_count;
continue;
}
- ds->poll_count++;
+ ds->poll_count = poll_count;
if ((read_ops == 0) && (write_ops == 0)) {
DEBUG("disk plugin: ((read_ops == 0) && "
/* Disk is missing, remove it */
diskstats_t *missing_ds = ds;
- if (pre_ds == disklist) {
- disklist = ds->next;
- ds = disklist;
- pre_ds = ds;
+ if (ds == disklist) {
+ pre_ds = disklist = ds->next;
} else {
pre_ds->next = ds->next;
- ds = ds->next;
}
+ ds = ds->next;
DEBUG("disk plugin: Disk %s disappeared.", missing_ds->name);
free(missing_ds->name);
}
if (numdisk != pnumdisk || stat_disk == NULL) {
- if (stat_disk != NULL)
- free(stat_disk);
- stat_disk = (perfstat_disk_t *)calloc(numdisk, sizeof(perfstat_disk_t));
+ free(stat_disk);
+ stat_disk = calloc(numdisk, sizeof(*stat_disk));
}
pnumdisk = numdisk;