"table_states", "disk_io", "disk_usage"};
static int def_queries_num = STATIC_ARRAY_SIZE(def_queries);
-static c_psql_database_t **databases = NULL;
-static size_t databases_num = 0;
+static c_psql_database_t **databases;
+static size_t databases_num;
-static udb_query_t **queries = NULL;
-static size_t queries_num = 0;
+static udb_query_t **queries;
+static size_t queries_num;
-static c_psql_writer_t *writers = NULL;
-static size_t writers_num = 0;
+static c_psql_writer_t *writers;
+static size_t writers_num;
static int c_psql_begin(c_psql_database_t *db) {
PGresult *r = PQexec(db->conn, "BEGIN");
} /* 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)
} /* c_psql_flush */
static int c_psql_shutdown(void) {
- bool had_flush = 0;
+ bool had_flush = false;
plugin_unregister_read_group("postgresql");
if (!had_flush) {
plugin_unregister_flush("postgresql");
- had_flush = 1;
+ had_flush = true;
}
plugin_unregister_flush(cb_name);
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;
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 */
} /* c_psql_config_database */
static int c_psql_config(oconfig_item_t *ci) {
- static int have_def_config = 0;
+ static int have_def_config;
if (0 == have_def_config) {
oconfig_item_t *c;