]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
cmds: Reworked some code in src/daemon/plugin.[ch].
authorFlorian Forster <octo@google.com>
Fri, 17 Jul 2020 10:29:09 +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/utils/cmds/getthreshold.c
src/utils/cmds/putval.c

index 73ce83bf4f9189ea3f6485fa2249bf754e366a86..b84b286ea63e6f5c4000f4829ba9624a65c56db9 100644 (file)
@@ -101,7 +101,7 @@ int handle_getthreshold(FILE *fh, char *buffer) {
   }
 
   metric_t metric = METRIC_STRUCT_INIT;
-  metric.identity = create_identity(plugin, type, data_source, host);
+  metric.identity = identity_create_legacy(plugin, type, data_source, host);
   sstrncpy(metric.plugin, plugin, sizeof(metric.plugin));
   sstrncpy(metric.type, type, sizeof(metric.type));
   metric.ds = plugin_get_ds(metric.type);
index e4ae49ae31b1e2dc1956d05b69977daeae96b275..507ca1267593927df7b3297e6d1141db88f33428 100644 (file)
@@ -149,7 +149,7 @@ cmd_status_t cmd_parse_putval(size_t argc, char **argv,
     return CMD_PARSE_ERROR;
   }
 
-  metric.identity = create_identity(plugin, type, data_source, hostname);
+  metric.identity = identity_create_legacy(plugin, type, data_source, hostname);
   if (metric.identity == NULL) {
     sfree(identifier_copy);
     return CMD_PARSE_ERROR;