]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
fix codestyle
authorSvetlana Shmidt <sshmidt@google.com>
Wed, 9 Sep 2020 09:13:41 +0000 (09:13 +0000)
committerSvetlana Shmidt <sshmidt@google.com>
Wed, 9 Sep 2020 09:13:41 +0000 (09:13 +0000)
src/daemon/distribution.c
src/daemon/distribution.h
src/daemon/utils_cache.c
src/daemon/utils_cache.h

index 84aba32d9eb363ecc8f77dee1423d173a312d1c0..aa533e8aeaee70539958ad7b6d99791eeab3a18d 100644 (file)
@@ -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;
 }
-
index 6c837f708a43a77f05125c78fdafbf4fb69dd0e2..6deb65bdbb16c18017598fcec50611099e30ea9c 100644 (file)
@@ -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
index 424e9c2146cd0df0cd007587e13b4e3f638da911..52c390db8eb8cd815a4d03bfe92973e406db3759 100644 (file)
@@ -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) {
index a4ef106f28735843f6781054c8a89872729556be..b23813ad5504d02c50e5fad5bc0e21952cac081c 100644 (file)
@@ -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);