X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpostgresql.c;h=9adba7d28c6065c8c8630d91c60e3a9bf14dd9c4;hb=a396da422740caf336a6d594515e8d80de6f440a;hp=7316c5478e449a82d0b0576a10cf6b2f15523e01;hpb=61a4ed99b1a5b6d371bb745933d0efc5dff9505c;p=collectd.git diff --git a/src/postgresql.c b/src/postgresql.c index 7316c547..9adba7d2 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -155,13 +155,13 @@ static const char *const def_queries[] = { "table_states", "disk_io", "disk_usage"}; static int def_queries_num = STATIC_ARRAY_SIZE(def_queries); -static c_psql_database_t **databases = NULL; +static c_psql_database_t **databases; static size_t databases_num = 0; -static udb_query_t **queries = NULL; +static udb_query_t **queries; static size_t queries_num = 0; -static c_psql_writer_t *writers = NULL; +static c_psql_writer_t *writers; static size_t writers_num = 0; static int c_psql_begin(c_psql_database_t *db) { @@ -348,10 +348,10 @@ static int c_psql_connect(c_psql_database_t *db) { } /* c_psql_connect */ static int c_psql_check_connection(c_psql_database_t *db) { - bool init = 0; + bool init = false; if (!db->conn) { - init = 1; + init = true; /* trigger c_release() */ if (0 == db->conn_complaint.interval) @@ -936,7 +936,7 @@ static int c_psql_flush(cdtime_t timeout, } /* c_psql_flush */ static int c_psql_shutdown(void) { - bool had_flush = 0; + bool had_flush = false; plugin_unregister_read_group("postgresql"); @@ -949,7 +949,7 @@ static int c_psql_shutdown(void) { if (!had_flush) { plugin_unregister_flush("postgresql"); - had_flush = 1; + had_flush = true; } plugin_unregister_flush(cb_name); @@ -1097,7 +1097,7 @@ static int c_psql_config_writer(oconfig_item_t *ci) { writer->name = sstrdup(ci->values[0].value.string); writer->statement = NULL; - writer->store_rates = 1; + writer->store_rates = true; for (int i = 0; i < ci->children_num; ++i) { oconfig_item_t *c = ci->children + i; @@ -1124,7 +1124,7 @@ static int c_psql_config_database(oconfig_item_t *ci) { c_psql_database_t *db; char cb_name[DATA_MAX_NAME_LEN]; - static bool have_flush = 0; + static bool have_flush; if ((1 != ci->values_num) || (OCONFIG_TYPE_STRING != ci->values[0].type)) { log_err(" expects a single string argument."); @@ -1221,7 +1221,7 @@ static int c_psql_config_database(oconfig_item_t *ci) { if (!have_flush) { /* flush all */ plugin_register_flush("postgresql", c_psql_flush, /* user data = */ NULL); - have_flush = 1; + have_flush = true; } /* flush this connection only */