X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frouteros.c;h=5fc14db5dd0b9fc0a928bbad340660318ee84809;hb=5cd5988ec752f441254fc887117c3d5aa8f8d094;hp=7ee302487f9dd841c9a35aeac86fef54eb9a597b;hpb=7b64cc91d3307179557b25b6ece2349a088f4294;p=collectd.git diff --git a/src/routeros.c b/src/routeros.c index 7ee30248..5fc14db5 100644 --- a/src/routeros.c +++ b/src/routeros.c @@ -25,6 +25,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" @@ -324,9 +325,7 @@ static int cr_config_router (oconfig_item_t *ci) /* {{{ */ { cr_data_t *router_data; char read_name[128]; - user_data_t user_data; int status; - int i; router_data = calloc (1, sizeof (*router_data)); if (router_data == NULL) @@ -338,7 +337,7 @@ static int cr_config_router (oconfig_item_t *ci) /* {{{ */ router_data->password = NULL; status = 0; - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; @@ -409,11 +408,12 @@ static int cr_config_router (oconfig_item_t *ci) /* {{{ */ } ssnprintf (read_name, sizeof (read_name), "routeros/%s", router_data->node); - user_data.data = router_data; - user_data.free_func = (void *) cr_free_data; if (status == 0) status = plugin_register_complex_read (/* group = */ NULL, read_name, - cr_read, /* interval = */ 0, &user_data); + cr_read, /* interval = */ 0, &(user_data_t) { + .data = router_data, + .free_func = (void *) cr_free_data, + }); if (status != 0) cr_free_data (router_data); @@ -423,9 +423,7 @@ static int cr_config_router (oconfig_item_t *ci) /* {{{ */ static int cr_config (oconfig_item_t *ci) { - int i; - - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i;