X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdbi.c;h=fefbf87bcab0a4a101e6bd2a1f899a37394d3052;hb=0a8741b9061f8df4a78a448c021612db06e17425;hp=b93aa51e39f440cd8cbd3fb1f4646948b67563ba;hpb=da612fa9c6a3343b43789569d64197d7c690be52;p=collectd.git diff --git a/src/dbi.c b/src/dbi.c index b93aa51e..fefbf87b 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -28,7 +28,6 @@ #include "common.h" #include "plugin.h" -#include "configfile.h" #include "utils_db_query.h" #include @@ -391,23 +390,19 @@ static int cdbi_config_add_database (oconfig_item_t *ci) /* {{{ */ } else { - user_data_t ud = { 0 }; - char *name = NULL; - databases = temp; databases[databases_num] = db; databases_num++; - ud.data = (void *) db; - ud.free_func = NULL; - name = ssnprintf_alloc("dbi:%s", db->name); - + char *name = ssnprintf_alloc("dbi:%s", db->name); plugin_register_complex_read (/* group = */ NULL, /* name = */ name ? name : db->name, /* callback = */ cdbi_read_database, /* interval = */ (db->interval > 0) ? db->interval : 0, - /* user_data = */ &ud); - free (name); + &(user_data_t) { + .data = db, + }); + sfree (name); } } @@ -452,14 +447,14 @@ static int cdbi_init (void) /* {{{ */ if (queries_num == 0) { ERROR ("dbi plugin: No blocks have been found. Without them, " - "this plugin can't do anything useful, so we will returns an error."); + "this plugin can't do anything useful, so we will return an error."); return (-1); } if (databases_num == 0) { ERROR ("dbi plugin: No blocks have been found. Without them, " - "this plugin can't do anything useful, so we will returns an error."); + "this plugin can't do anything useful, so we will return an error."); return (-1); }