X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Futils_cache.c;h=df358d26530789a36cf1a761ef91950c997f2abd;hb=21c84cec32921e6de8feaa5496f337496379ea23;hp=8e28a5d8baa8664be221676ef0023bef52745ed9;hpb=61a4ed99b1a5b6d371bb745933d0efc5dff9505c;p=collectd.git diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index 8e28a5d8..df358d26 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -28,10 +28,10 @@ #include "collectd.h" -#include "common.h" -#include "meta_data.h" #include "plugin.h" -#include "utils_avltree.h" +#include "utils/avltree/avltree.h" +#include "utils/common/common.h" +#include "utils/metadata/meta_data.h" #include "utils_cache.h" #include @@ -76,7 +76,7 @@ struct uc_iter_s { cache_entry_t *entry; }; -static c_avl_tree_t *cache_tree = NULL; +static c_avl_tree_t *cache_tree; static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER; static int cache_compare(const cache_entry_t *a, const cache_entry_t *b) { @@ -201,7 +201,7 @@ static int uc_insert(const data_set_t *ds, const value_list_t *vl, ce->last_time = vl->time; ce->last_update = cdtime(); ce->interval = vl->interval; - ce->state = STATE_OKAY; + ce->state = STATE_UNKNOWN; if (c_avl_insert(cache_tree, key_copy, ce) != 0) { sfree(key_copy); @@ -275,7 +275,8 @@ int uc_check_timeout(void) { * plugin calls the cache interface. */ for (size_t i = 0; i < expired_num; i++) { value_list_t vl = { - .time = expired[i].time, .interval = expired[i].interval, + .time = expired[i].time, + .interval = expired[i].interval, }; if (parse_identifier_vl(expired[i].key, &vl) != 0) { @@ -826,9 +827,7 @@ int uc_inc_hits(const data_set_t *ds, const value_list_t *vl, int step) { * Iterator interface */ uc_iter_t *uc_get_iterator(void) { - uc_iter_t *iter; - - iter = (uc_iter_t *)calloc(1, sizeof(*iter)); + uc_iter_t *iter = calloc(1, sizeof(*iter)); if (iter == NULL) return NULL;