X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fswap.c;h=645dc586023523ae7af55722da4f20e3ca416442;hb=71bbf854d3e6f8c6d6c3582527263bb01a3a7e04;hp=cfde4ea6d2bd9d194abbab16d4d2269e7347e114;hpb=add25ce6f3129cb7138e96e5f55d11de1e5cf6de;p=collectd.git diff --git a/src/swap.c b/src/swap.c index cfde4ea6..645dc586 100644 --- a/src/swap.c +++ b/src/swap.c @@ -82,6 +82,10 @@ static derive_t pagesize; static _Bool report_by_device = 0; /* #endif HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS */ +#elif HAVE_SWAPCTL && HAVE_SWAPCTL_THREE_ARGS +/* No global variables */ +/* #endif HAVE_SWAPCTL && HAVE_SWAPCTL_THREE_ARGS */ + #elif defined(VM_SWAPUSAGE) /* No global variables */ /* #endif defined(VM_SWAPUSAGE) */ @@ -521,10 +525,10 @@ static int swap_read (void) /* {{{ */ return (0); /* Allocate and initialize the swaptbl_t structure */ - s = (swaptbl_t *) smalloc (swap_num * sizeof (swapent_t) + sizeof (struct swaptable)); + s = malloc (swap_num * sizeof (swapent_t) + sizeof (struct swaptable)); if (s == NULL) { - ERROR ("swap plugin: smalloc failed."); + ERROR ("swap plugin: malloc failed."); return (-1); } @@ -534,7 +538,7 @@ static int swap_read (void) /* {{{ */ s_paths = calloc (swap_num, PATH_MAX); if (s_paths == NULL) { - ERROR ("swap plugin: malloc failed."); + ERROR ("swap plugin: calloc failed."); sfree (s); return (-1); } @@ -757,14 +761,13 @@ static int swap_read (void) /* {{{ */ #elif HAVE_PERFSTAT static int swap_read (void) /* {{{ */ { - perfstat_memory_total_t pmemory; + perfstat_memory_total_t pmemory = { 0 }; int status; gauge_t total; gauge_t free; gauge_t reserved; - memset (&pmemory, 0, sizeof (pmemory)); status = perfstat_memory_total (NULL, &pmemory, sizeof(perfstat_memory_total_t), 1); if (status < 0) {