X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fzone.c;h=d9e46f5ad1ea690ca022b2732c09a3918046f558;hb=4d370741101aeb037ae52f3529a4a0869e0dc08a;hp=ba07c9efcb84aab86dfd416ec66d8ba9249d8d02;hpb=d2ef97c0604aac14dba6e43d5478c0372bc3ced9;p=collectd.git diff --git a/src/zone.c b/src/zone.c index ba07c9ef..d9e46f5a 100644 --- a/src/zone.c +++ b/src/zone.c @@ -31,11 +31,10 @@ #endif #include "collectd.h" + #include "common.h" #include "plugin.h" -#include -#include #include #include @@ -50,11 +49,11 @@ typedef struct zone_stats { } zone_stats_t; static int -zone_compare(const zoneid_t *a, const zoneid_t *b) +zone_compare(const void *a, const void *b) { - if (*a == *b) + if (*(const zoneid_t *)a == *(const zoneid_t *)b) return(0); - if (*a < *b) + if (*(const zoneid_t *)a < *(const zoneid_t *)b) return(-1); return(1); } @@ -135,7 +134,7 @@ zone_submit_values(c_avl_tree_t *tree) while (c_avl_pick (tree, (void **)&zoneid, (void **)&stats) == 0) { if (getzonenamebyid(*zoneid, zonename, sizeof( zonename )) == -1) { - WARNING("zone plugin: error retreiving zonename"); + WARNING("zone plugin: error retrieving zonename"); } else { zone_submit_value(zonename, (gauge_t)FRC2PCT(stats->pctcpu)); } @@ -154,7 +153,7 @@ zone_scandir(DIR *procdir) c_avl_tree_t *tree; zone_stats_t *stats; - if (!(tree=c_avl_create((void *) zone_compare))) { + if (!(tree=c_avl_create(zone_compare))) { WARNING("zone plugin: Failed to create tree"); return(NULL); }