From: Svetlana Shmidt Date: Wed, 9 Sep 2020 09:13:41 +0000 (+0000) Subject: fix codestyle X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=58abdfefcc23cbf95fd76f9866c93d4fcf8797cc;p=thirdparty%2Fcollectd.git fix codestyle --- diff --git a/src/daemon/distribution.c b/src/daemon/distribution.c index 84aba32d9..aa533e8ae 100644 --- a/src/daemon/distribution.c +++ b/src/daemon/distribution.c @@ -363,15 +363,18 @@ static int *distribution_cmp(distribution_t *d1, distribution_t *d2) { return comparison; } for (size_t i = 0; i < tree_size(d1->num_buckets); i++) { - if (d1->tree[i].maximum != d2->tree[i].maximum) { // will it work with doubles? + if (d1->tree[i].maximum != + d2->tree[i].maximum) { // will it work with doubles? comparison[0] = EINVAL; return comparison; } } - int res = compare_longint(d1->tree[0].bucket_counter, d2->tree[0].bucket_counter); + int res = + compare_longint(d1->tree[0].bucket_counter, d2->tree[0].bucket_counter); for (size_t i = 1; i < tree_size(d1->num_buckets); i++) { - int cur_res = compare_longint(d1->tree[i].bucket_counter, d2->tree[i].bucket_counter); + int cur_res = + compare_longint(d1->tree[i].bucket_counter, d2->tree[i].bucket_counter); if (res != cur_res) { if (cur_res == 0) continue; @@ -404,7 +407,8 @@ int distribution_sub(distribution_t *d1, distribution_t *d2) { pthread_mutex_lock(&d2->mutex); int *cmp_status = distribution_cmp(d1, d2); - if (cmp_status[0] != 0 || cmp_status[1] == -1) { // i.e. d1 < d2 or can't compare + if (cmp_status[0] != 0 || + cmp_status[1] == -1) { // i.e. d1 < d2 or can't compare int status = cmp_status[0]; if (cmp_status[1] == -1) status = ERANGE; @@ -425,4 +429,3 @@ int distribution_sub(distribution_t *d1, distribution_t *d2) { free(cmp_status); return 0; } - diff --git a/src/daemon/distribution.h b/src/daemon/distribution.h index 6c837f708..6deb65bdb 100644 --- a/src/daemon/distribution.h +++ b/src/daemon/distribution.h @@ -119,13 +119,16 @@ double distribution_squared_deviation_sum(distribution_t *dist); void destroy_buckets_array(buckets_array_t buckets_array); /** @return true if distributions are equal false otherwise - * This function holds both mutexes for d1 and d2. Be sure that you call the function with the same order of arguments everytime **/ + * This function holds both mutexes for d1 and d2. Be sure that you call the + * function with the same order of arguments everytime **/ bool distribution_equals(distribution_t *d1, distribution_t *d2); /** This function subtracts d2 from d1 if arguments are correct - * if arguments are NULL pointers or the structure of distributions is different then EINVAL is returned - * if distributions have the same structure but the second distribution is not less then the first then ERANGE is returned - * in case of success returns 0 - * This function holds both mutexes for d1 and d2. Be sure that you call the function with the same order of arguments everytime **/ + * if arguments are NULL pointers or the structure of distributions is + * different then EINVAL is returned if distributions have the same structure + * but the second distribution is not less then the first then ERANGE is + * returned in case of success returns 0 + * This function holds both mutexes for d1 and d2. Be sure that you call the + * function with the same order of arguments everytime **/ int distribution_sub(distribution_t *d1, distribution_t *d2); #endif // COLLECTD_DISTRIBUTION_H \ No newline at end of file diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index 424e9c214..52c390db8 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -361,8 +361,8 @@ static int uc_update_metric(metric_t const *m) { case METRIC_TYPE_DISTRIBUTION: { distribution_destroy(ce->distribution_increase); ce->distribution_increase = distribution_clone(m->value.distribution); - status = - distribution_sub(ce->distribution_increase, ce->values_raw.distribution); + status = distribution_sub(ce->distribution_increase, + ce->values_raw.distribution); if (status == ERANGE) { distribution_destroy(ce->distribution_increase); ce->distribution_increase = distribution_clone(m->value.distribution); @@ -490,7 +490,7 @@ int uc_get_percentile_by_name(const char *name, gauge_t *ret_values, name); status = -1; } else { - if (ce->distribution_increase == NULL && + if (ce->distribution_increase == NULL && ce->values_raw.distribution != NULL) { /* check if the cache entry is not the distribution */ pthread_mutex_unlock(&cache_lock); @@ -666,12 +666,13 @@ int uc_get_value(metric_t const *m, value_t *ret) { return status; } /* value_t *uc_get_value */ -int uc_get_start_value_by_name(const char *name, value_t *ret_start_value, cdtime_t *ret_start_time) { +int uc_get_start_value_by_name(const char *name, value_t *ret_start_value, + cdtime_t *ret_start_time) { pthread_mutex_lock(&cache_lock); cache_entry_t *ce = NULL; int status = 0; - if (c_avl_get(cache_tree, name, (void *) &ce) == 0) { + if (c_avl_get(cache_tree, name, (void *)&ce) == 0) { assert(ce != NULL); /* remove missing values from getval */ @@ -691,7 +692,8 @@ int uc_get_start_value_by_name(const char *name, value_t *ret_start_value, cdtim return status; } -int uc_get_start_value(metric_t const *m, value_t *ret_start_value, cdtime_t *ret_start_time) { +int uc_get_start_value(metric_t const *m, value_t *ret_start_value, + cdtime_t *ret_start_time) { strbuf_t buf = STRBUF_CREATE; int status = metric_identity(&buf, m); if (status != 0) { diff --git a/src/daemon/utils_cache.h b/src/daemon/utils_cache.h index a4ef106f2..b23813ad5 100644 --- a/src/daemon/utils_cache.h +++ b/src/daemon/utils_cache.h @@ -55,8 +55,10 @@ int uc_get_rate_by_name(const char *name, gauge_t *ret_value); int uc_get_rate(metric_t const *m, gauge_t *ret_value); int uc_get_value_by_name(const char *name, value_t *ret_value); int uc_get_value(metric_t const *m, value_t *ret_value); -int uc_get_start_value_by_name(const char *name, value_t *ret_start_value, cdtime_t *ret_start_time); -int uc_get_start_value(metric_t const *m, value_t *ret_start_value, cdtime_t *ret_start_time); +int uc_get_start_value_by_name(const char *name, value_t *ret_start_value, + cdtime_t *ret_start_time); +int uc_get_start_value(metric_t const *m, value_t *ret_start_value, + cdtime_t *ret_start_time); size_t uc_get_size(void); int uc_get_names(char ***ret_names, cdtime_t **ret_times, size_t *ret_number);