]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
barometer, python plugins: Reworked some code in src/daemon/plugin.[ch].
authorFlorian Forster <octo@google.com>
Fri, 17 Jul 2020 10:29:28 +0000 (12:29 +0200)
committerFlorian Forster <octo@google.com>
Wed, 29 Jul 2020 11:40:03 +0000 (13:40 +0200)
Unfortunately it's all a bit messy and entangled. Since this is such
an early WIP, I didn't spend the (substantial) time needed to pick this
into separate changes. The changes in this commit are:

*   Create a consistent naming schema for the identity functions:
    *   Rename "create_identity" to "identity_create_legacy".
    *   Rename "clone_identity" to "identity_clone".
    *   Rename "destroy_identity" to "identity_destroy".
*   Add "identity_create" to allocate a new identity_t.
*   Copy key and value strings within "identity_add_label".
    *   Make use of "identity_create" and "identity_add_label" in
        "identity_clone", "identity_create_legacy" and others that used
        to fiddle with the AVL tree directly.
*   Remove the "_p" suffix used for pointers. This is quite unusual for
    the collectd codebase.

# Conflicts:
# src/daemon/metrics_list_test.c

src/barometer.c
src/pyvalues.c

index 121e8beac273d159421aaa6f4bb11874f846336f..10ea6de73e3d5ed86b4708ff6b36e8c3658ce5d2 100644 (file)
@@ -1405,7 +1405,7 @@ static int MPL115_collectd_barometer_read(void) {
   norm_pressure = abs_to_mean_sea_level_pressure(pressure);
 
   index_p->metric.identity =
-      create_identity("barometer", "pressure", "value", NULL);
+      identity_create_legacy("barometer", "pressure", "value", NULL);
   if (index_p->metric.identity == NULL) {
     destroy_metrics_list(ml);
     return -1;
@@ -1434,7 +1434,7 @@ static int MPL115_collectd_barometer_read(void) {
   index_p->next_p = NULL;
 
   index_p->metric.identity =
-      create_identity("barometer", "pressure", "value", NULL);
+      identity_create_legacy("barometer", "pressure", "value", NULL);
   if (index_p->metric.identity == NULL) {
     destroy_metrics_list(ml);
     return -1;
@@ -1465,7 +1465,7 @@ static int MPL115_collectd_barometer_read(void) {
 
   /* dispatch sensor temperature */
   index_p->metric.identity =
-      create_identity("barometer", "temperature", "value", NULL);
+      identity_create_legacy("barometer", "temperature", "value", NULL);
 
   index_p->metric.value.gauge = temperature;
 
index c733224b854c056c2aa6aaf66e9e61deb7e6f352..8d52b6a0a8fb5551edd68153810c25c953fdade1 100644 (file)
@@ -726,7 +726,7 @@ static PyObject *Values_write(Values *self, PyObject *args, PyObject *kwds) {
           NULL, &host, &time, &interval, &meta))
     return NULL;
 
-  metric.identity = create_identity((plugin ? plugin : self->data.plugin),
+  metric.identity = identity_create_legacy((plugin ? plugin : self->data.plugin),
                                     (type ? type : self->data.type),
                                     (host ? host : self->data.host));