Merge pull request #1816 from octo/grpc-free-iter
[collectd.git] / src / threshold.c
index ed83129..77ba3f3 100644 (file)
@@ -30,9 +30,6 @@
 #include "utils_cache.h"
 #include "utils_threshold.h"
 
-#include <assert.h>
-#include <pthread.h>
-
 /*
  * Threshold management
  * ====================
@@ -70,7 +67,7 @@ static int ut_threshold_add (const threshold_t *th)
     return (-1);
   }
 
-  th_copy = (threshold_t *) malloc (sizeof (threshold_t));
+  th_copy = malloc (sizeof (*th_copy));
   if (th_copy == NULL)
   {
     sfree (name_copy);
@@ -78,7 +75,6 @@ static int ut_threshold_add (const threshold_t *th)
     return (-1);
   }
   memcpy (th_copy, th, sizeof (threshold_t));
-  th_ptr = NULL;
 
   DEBUG ("ut_threshold_add: Adding entry `%s'", name);
 
@@ -878,7 +874,7 @@ static int ut_config (oconfig_item_t *ci)
 
   if (threshold_tree == NULL)
   {
-    threshold_tree = c_avl_create ((void *) strcmp);
+    threshold_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
     if (threshold_tree == NULL)
     {
       ERROR ("ut_config: c_avl_create failed.");