projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
grpc plugin: Create a "Dispatch" service and use streaming RPCs.
[collectd.git]
/
src
/
threshold.c
diff --git
a/src/threshold.c
b/src/threshold.c
index
ed83129
..
f12b405
100644
(file)
--- a/
src/threshold.c
+++ b/
src/threshold.c
@@
-30,9
+30,6
@@
#include "utils_cache.h"
#include "utils_threshold.h"
#include "utils_cache.h"
#include "utils_threshold.h"
-#include <assert.h>
-#include <pthread.h>
-
/*
* Threshold management
* ====================
/*
* Threshold management
* ====================
@@
-70,7
+67,7
@@
static int ut_threshold_add (const threshold_t *th)
return (-1);
}
return (-1);
}
- th_copy =
(threshold_t *) malloc (sizeof (threshold_t
));
+ th_copy =
malloc (sizeof (*th_copy
));
if (th_copy == NULL)
{
sfree (name_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));
return (-1);
}
memcpy (th_copy, th, sizeof (threshold_t));
- th_ptr = NULL;
DEBUG ("ut_threshold_add: Adding entry `%s'", name);
DEBUG ("ut_threshold_add: Adding entry `%s'", name);
@@
-874,11
+870,9
@@
static int ut_config (oconfig_item_t *ci)
int status = 0;
int old_size = c_avl_size (threshold_tree);
int status = 0;
int old_size = c_avl_size (threshold_tree);
- threshold_t th;
-
if (threshold_tree == NULL)
{
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.");
if (threshold_tree == NULL)
{
ERROR ("ut_config: c_avl_create failed.");
@@
-886,15
+880,13
@@
static int ut_config (oconfig_item_t *ci)
}
}
}
}
- memset (&th, '\0', sizeof (th));
- th.warning_min = NAN;
- th.warning_max = NAN;
- th.failure_min = NAN;
- th.failure_max = NAN;
-
- th.hits = 0;
- th.hysteresis = 0;
- th.flags = UT_FLAG_INTERESTING; /* interesting by default */
+ threshold_t th = {
+ .warning_min = NAN,
+ .warning_max = NAN,
+ .failure_min = NAN,
+ .failure_max = NAN,
+ .flags = UT_FLAG_INTERESTING /* interesting by default */
+ };
for (i = 0; i < ci->children_num; i++)
{
for (i = 0; i < ci->children_num; i++)
{