X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fzone.c;h=40c4d2ee5a3dad252f5a40d59bd883f0a419f434;hb=2ce1db8202b1eba6da45b347c0c81a508f8c088a;hp=15eae6a222fa942116841c36c0dd20f6676417e1;hpb=7bab45b57d6ef99ae55c499c51478dd63c3b1397;p=collectd.git diff --git a/src/zone.c b/src/zone.c index 15eae6a2..40c4d2ee 100644 --- a/src/zone.c +++ b/src/zone.c @@ -34,8 +34,6 @@ #include "common.h" #include "plugin.h" -#include -#include #include #include @@ -49,14 +47,6 @@ typedef struct zone_stats { ushort_t pctmem; } zone_stats_t; -static long pagesize; - -static int zone_init (void) -{ - pagesize = sysconf(_SC_PAGESIZE); - return (0); -} - static int zone_compare(const zoneid_t *a, const zoneid_t *b) { @@ -115,12 +105,13 @@ zone_find_stats(c_avl_tree_t *tree, zoneid_t zoneid) zoneid_t *key = NULL; if (c_avl_get(tree, (void **)&zoneid, (void **)&ret)) { - if (!(ret = malloc(sizeof(zone_stats_t)))) { + if (!(ret = malloc(sizeof(*ret)))) { WARNING("zone plugin: no memory"); return(NULL); } - if (!(key = malloc(sizeof(zoneid_t)))) { + if (!(key = malloc(sizeof(*key)))) { WARNING("zone plugin: no memory"); + free(ret); return(NULL); } *key = zoneid; @@ -209,6 +200,5 @@ static int zone_read (void) void module_register (void) { - plugin_register_init ("zone", zone_init); plugin_register_read ("zone", zone_read); } /* void module_register */