Merge branch 'collectd-5.7' into collectd-5.8
[collectd.git] / src / collectd-tg.c
index a0fe284..48f2dc4 100644 (file)
@@ -107,7 +107,7 @@ static double dtime(void) /* {{{ */
   if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
     perror("clock_gettime");
 
-  return ((double)ts.tv_sec) + (((double)ts.tv_nsec) / 1e9);
+  return (double)ts.tv_sec + (double)ts.tv_nsec / 1e9;
 } /* }}} double dtime */
 #else
 /* Work around for Mac OS X which doesn't have clock_gettime(2). *sigh* */
@@ -118,7 +118,7 @@ static double dtime(void) /* {{{ */
   if (gettimeofday(&tv, /* timezone = */ NULL) != 0)
     perror("gettimeofday");
 
-  return ((double)tv.tv_sec) + (((double)tv.tv_usec) / 1e6);
+  return (double)tv.tv_sec + ((double)tv.tv_usec) / 1e6;
 } /* }}} double dtime */
 #endif
 
@@ -128,11 +128,11 @@ static int compare_time(const void *v0, const void *v1) /* {{{ */
   const lcc_value_list_t *vl1 = v1;
 
   if (vl0->time < vl1->time)
-    return (-1);
+    return -1;
   else if (vl0->time > vl1->time)
-    return (1);
+    return 1;
   else
-    return (0);
+    return 0;
 } /* }}} int compare_time */
 
 static int get_boundet_random(int min, int max) /* {{{ */
@@ -140,14 +140,13 @@ static int get_boundet_random(int min, int max) /* {{{ */
   int range;
 
   if (min >= max)
-    return (-1);
+    return -1;
   if (min == (max - 1))
-    return (min);
+    return min;
 
   range = max - min;
 
-  return (min + ((int)(((double)range) * ((double)random()) /
-                       (((double)RAND_MAX) + 1.0))));
+  return min + ((int)(((double)range) * ((double)random()) / (((double)RAND_MAX) + 1.0)));
 } /* }}} int get_boundet_random */
 
 static lcc_value_list_t *create_value_list(void) /* {{{ */
@@ -158,14 +157,14 @@ static lcc_value_list_t *create_value_list(void) /* {{{ */
   vl = calloc(1, sizeof(*vl));
   if (vl == NULL) {
     fprintf(stderr, "calloc failed.\n");
-    return (NULL);
+    return NULL;
   }
 
   vl->values = calloc(/* nmemb = */ 1, sizeof(*vl->values));
   if (vl->values == NULL) {
     fprintf(stderr, "calloc failed.\n");
     free(vl);
-    return (NULL);
+    return NULL;
   }
 
   vl->values_types = calloc(/* nmemb = */ 1, sizeof(*vl->values_types));
@@ -173,7 +172,7 @@ static lcc_value_list_t *create_value_list(void) /* {{{ */
     fprintf(stderr, "calloc failed.\n");
     free(vl->values);
     free(vl);
-    return (NULL);
+    return NULL;
   }
 
   vl->values_len = 1;
@@ -199,7 +198,7 @@ static lcc_value_list_t *create_value_list(void) /* {{{ */
   snprintf(vl->identifier.type_instance, sizeof(vl->identifier.type_instance),
            "ti%li", random());
 
-  return (vl);
+  return vl;
 } /* }}} int create_value_list */
 
 static void destroy_value_list(lcc_value_list_t *vl) /* {{{ */
@@ -228,7 +227,7 @@ static int send_value(lcc_value_list_t *vl) /* {{{ */
 
   vl->time += vl->interval;
 
-  return (0);
+  return 0;
 } /* }}} int send_value */
 
 static int get_integer_opt(const char *str, int *ret_value) /* {{{ */
@@ -252,7 +251,7 @@ static int get_integer_opt(const char *str, int *ret_value) /* {{{ */
   }
 
   *ret_value = tmp;
-  return (0);
+  return 0;
 } /* }}} int get_integer_opt */
 
 static int get_double_opt(const char *str, double *ret_value) /* {{{ */
@@ -276,7 +275,7 @@ static int get_double_opt(const char *str, double *ret_value) /* {{{ */
   }
 
   *ret_value = tmp;
-  return (0);
+  return 0;
 } /* }}} int get_double_opt */
 
 static int read_options(int argc, char **argv) /* {{{ */
@@ -317,7 +316,7 @@ static int read_options(int argc, char **argv) /* {{{ */
     } /* switch (opt) */
   }   /* while (getopt) */
 
-  return (0);
+  return 0;
 } /* }}} int read_options */
 
 int main(int argc, char **argv) /* {{{ */