X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_mongodb.c;h=8fb13c3486bef46f5caa6abb7c3634f6385d0e43;hb=448627953cde2f7b3b138f53f4f2c62f0d48b726;hp=9a6fdf2697da4b52c7ba7d5fd5f8f39ed96c73c6;hpb=50345eec33951b964e2829e83c30399b71f2baba;p=collectd.git diff --git a/src/write_mongodb.c b/src/write_mongodb.c index 9a6fdf26..8fb13c34 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -29,13 +29,12 @@ **/ #include "collectd.h" + #include "plugin.h" #include "common.h" #include "configfile.h" #include "utils_cache.h" -#include - #if HAVE_STDINT_H # define MONGO_HAVE_STDINT 1 #else @@ -77,7 +76,6 @@ static bson *wm_create_bson (const data_set_t *ds, /* {{{ */ { bson *ret; gauge_t *rates; - int i; ret = bson_alloc (); /* matched by bson_dealloc() */ if (ret == NULL) @@ -109,7 +107,7 @@ static bson *wm_create_bson (const data_set_t *ds, /* {{{ */ bson_append_string (ret, "type_instance", vl->type_instance); bson_append_start_array (ret, "values"); /* {{{ */ - for (i = 0; i < ds->ds_num; i++) + for (int i = 0; i < ds->ds_num; i++) { char key[16]; @@ -131,7 +129,7 @@ static bson *wm_create_bson (const data_set_t *ds, /* {{{ */ bson_append_finish_array (ret); /* }}} values */ bson_append_start_array (ret, "dstypes"); /* {{{ */ - for (i = 0; i < ds->ds_num; i++) + for (int i = 0; i < ds->ds_num; i++) { char key[16]; @@ -145,7 +143,7 @@ static bson *wm_create_bson (const data_set_t *ds, /* {{{ */ bson_append_finish_array (ret); /* }}} dstypes */ bson_append_start_array (ret, "dsnames"); /* {{{ */ - for (i = 0; i < ds->ds_num; i++) + for (int i = 0; i < ds->ds_num; i++) { char key[16]; @@ -272,7 +270,6 @@ static int wm_config_node (oconfig_item_t *ci) /* {{{ */ { wm_node_t *node; int status; - int i; node = calloc (1, sizeof (*node)); if (node == NULL) @@ -290,7 +287,7 @@ static int wm_config_node (oconfig_item_t *ci) /* {{{ */ return (status); } - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; @@ -359,9 +356,7 @@ static int wm_config_node (oconfig_item_t *ci) /* {{{ */ static int wm_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;