]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
perl plugin: More cleanups.
authorFlorian Forster <octo@google.com>
Fri, 17 Jul 2020 10:43:49 +0000 (12:43 +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/perl.c

index d6f316bf0b4e6c9ef4098795b3263d31ffab45d4..bf9c87f1517a9b1355718a556a8f5f123e9daf3a 100644 (file)
@@ -353,13 +353,13 @@ static int hv2metric_list(pTHX_ HV *hash, metric_t *metric_p) {
   SV **tmp = av_fetch(array, 0, 0);
 
   if (NULL != tmp) {
-    if (DS_TYPE_COUNTER == metric_p->value_ds_type)
+    if (DS_TYPE_COUNTER == metric_p->value_type)
       metric_p->value.counter = SvIV(*tmp);
-    else if (DS_TYPE_GAUGE == metric_p->value_ds_type)
+    else if (DS_TYPE_GAUGE == metric_p->value_type)
       metric_p->value.gauge = SvNV(*tmp);
-    else if (DS_TYPE_DERIVE == metric_p->value_ds_type)
+    else if (DS_TYPE_DERIVE == metric_p->value_type)
       metric_p->value.derive = SvIV(*tmp);
-    else if (DS_TYPE_ABSOLUTE == metric_p->value_ds_type)
+    else if (DS_TYPE_ABSOLUTE == metric_p->value_type)
       metric_p->value.absolute = SvIV(*tmp);
   } else {
     return 0;