]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
common: More cleanups.
authorFlorian Forster <octo@google.com>
Fri, 17 Jul 2020 10:42:42 +0000 (12:42 +0200)
committerFlorian Forster <octo@google.com>
Wed, 29 Jul 2020 11:40:03 +0000 (13:40 +0200)
*   Struct "metric_t": unnecessary fields "type", "plugin", "ds" have
    been removed. The field "value_ds_type" has been renamed to
    "value_type".
*   The reference counted, multiple instance "meta_data_list_head_t" type
    has been removed. Manually doing the reference counting all over the
    place is error prone and it seems like premature optimization.
*   The "<type>_destroy" functions must handle NULL gracefully. Removed
    NULL-checks around their invocation to improve readability.

# Conflicts:
# src/daemon/metrics_list_test.c

src/utils/common/common.c

index 000c090781a1b339b29066c722af6bd674fff8a7..f4771583502a57944482412f41ca1c706c065284 100644 (file)
@@ -911,7 +911,7 @@ int format_values(char *ret, size_t ret_len, /* {{{ */
 
   strbuf_printf(&buf, "%.3f", CDTIME_T_TO_DOUBLE(metric_p->time));
 
-  if (metric_p->value_ds_type == DS_TYPE_GAUGE)
+  if (metric_p->value_type == DS_TYPE_GAUGE)
     strbuf_printf(&buf, ":" GAUGE_FORMAT, metric_p->value.gauge);
   else if (store_rates) {
     gauge_t rates = NAN;
@@ -921,13 +921,13 @@ int format_values(char *ret, size_t ret_len, /* {{{ */
       return status;
     }
     strbuf_printf(&buf, ":" GAUGE_FORMAT, rates);
-  } else if (metric_p->value_ds_type == DS_TYPE_COUNTER)
+  } else if (metric_p->value_type == DS_TYPE_COUNTER)
     strbuf_printf(&buf, ":%" PRIu64, (uint64_t)metric_p->value.counter);
-  else if (metric_p->value_ds_type == DS_TYPE_DERIVE)
+  else if (metric_p->value_type == DS_TYPE_DERIVE)
     strbuf_printf(&buf, ":%" PRIi64, metric_p->value.derive);
   else {
     ERROR("format_values: Unknown data source type: %i",
-          metric_p->value_ds_type);
+          metric_p->value_type);
     return -1;
   }