X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_mongodb.c;h=b43906e6326c949b12ec46ac4561e3278c621f3f;hb=8cae217ea6c6afc0a0eb6e4348b75293572109b5;hp=f9bd1a0a84ecb71889a511825c8aa4569d7cc380;hpb=61a4ed99b1a5b6d371bb745933d0efc5dff9505c;p=collectd.git diff --git a/src/write_mongodb.c b/src/write_mongodb.c index f9bd1a0a..b43906e6 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -32,8 +32,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #include "utils_cache.h" #include @@ -170,7 +170,7 @@ static int wm_initialize(wm_node_t *node) /* {{{ */ "authentication string."); mongoc_client_destroy(node->client); node->client = NULL; - node->connected = 0; + node->connected = false; return -1; } @@ -179,7 +179,7 @@ static int wm_initialize(wm_node_t *node) /* {{{ */ ERROR("write_mongodb plugin: Authenticating to [%s]:%d for database " "\"%s\" as user \"%s\" failed.", node->host, node->port, node->db, node->user); - node->connected = 0; + node->connected = false; sfree(uri); return -1; } @@ -190,7 +190,7 @@ static int wm_initialize(wm_node_t *node) /* {{{ */ "authentication string."); mongoc_client_destroy(node->client); node->client = NULL; - node->connected = 0; + node->connected = false; return -1; } @@ -198,7 +198,7 @@ static int wm_initialize(wm_node_t *node) /* {{{ */ if (!node->client) { ERROR("write_mongodb plugin: Connecting to [%s]:%d failed.", node->host, node->port); - node->connected = 0; + node->connected = false; sfree(uri); return -1; } @@ -210,11 +210,11 @@ static int wm_initialize(wm_node_t *node) /* {{{ */ ERROR("write_mongodb plugin: error creating/getting database"); mongoc_client_destroy(node->client); node->client = NULL; - node->connected = 0; + node->connected = false; return -1; } - node->connected = 1; + node->connected = true; return 0; } /* }}} int wm_initialize */ @@ -248,7 +248,7 @@ static int wm_write(const data_set_t *ds, /* {{{ */ mongoc_client_destroy(node->client); node->database = NULL; node->client = NULL; - node->connected = 0; + node->connected = false; pthread_mutex_unlock(&node->lock); bson_destroy(bson_record); return -1; @@ -263,7 +263,7 @@ static int wm_write(const data_set_t *ds, /* {{{ */ mongoc_client_destroy(node->client); node->database = NULL; node->client = NULL; - node->connected = 0; + node->connected = false; pthread_mutex_unlock(&node->lock); bson_destroy(bson_record); mongoc_collection_destroy(collection); @@ -291,7 +291,7 @@ static void wm_config_free(void *ptr) /* {{{ */ mongoc_client_destroy(node->client); node->database = NULL; node->client = NULL; - node->connected = 0; + node->connected = false; sfree(node->host); sfree(node); @@ -312,7 +312,7 @@ static int wm_config_node(oconfig_item_t *ci) /* {{{ */ return ENOMEM; } node->port = MONGOC_DEFAULT_PORT; - node->store_rates = 1; + node->store_rates = true; pthread_mutex_init(&node->lock, /* attr = */ NULL); status = cf_util_get_string_buffer(ci, node->name, sizeof(node->name)); @@ -370,11 +370,11 @@ static int wm_config_node(oconfig_item_t *ci) /* {{{ */ snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name); - status = - plugin_register_write(cb_name, wm_write, - &(user_data_t){ - .data = node, .free_func = wm_config_free, - }); + status = plugin_register_write(cb_name, wm_write, + &(user_data_t){ + .data = node, + .free_func = wm_config_free, + }); INFO("write_mongodb plugin: registered write plugin %s %d", cb_name, status); }