-static udb_query_t **queries = NULL;
-static size_t queries_num = 0;
-static cdbi_database_t **databases = NULL;
-static size_t databases_num = 0;
+static udb_query_t **queries;
+static size_t queries_num;
+static cdbi_database_t **databases;
+static size_t databases_num;
msg = NULL;
status = dbi_conn_error(conn, &msg);
if ((status >= 0) && (msg != NULL))
msg = NULL;
status = dbi_conn_error(conn, &msg);
if ((status >= 0) && (msg != NULL))
- ssnprintf(buffer, buffer_size, "%s (status %i)", msg, status);
+ snprintf(buffer, buffer_size, "%s (status %i)", msg, status);
- ssnprintf(buffer, buffer_size, "dbi_conn_error failed with status %i",
- status);
+ snprintf(buffer, buffer_size, "dbi_conn_error failed with status %i",
+ status);
- ssnprintf(buffer, buffer_size, "%lli", value);
+ snprintf(buffer, buffer_size, "%lli", value);
} else if (src_type == DBI_TYPE_DECIMAL) {
double value;
value = dbi_result_get_double_idx(res, index);
} else if (src_type == DBI_TYPE_DECIMAL) {
double value;
value = dbi_result_get_double_idx(res, index);
- ssnprintf(buffer, buffer_size, "%63.15g", value);
+ snprintf(buffer, buffer_size, "%63.15g", value);
- free(db->q_prep_areas);
+ sfree(db->q_prep_areas);
+ /* N.B.: db->queries references objects "owned" by the global queries
+ * variable. Free the array here, but not the content. */
+ sfree(db->queries);
} else {
assert(ci->values[1].type == OCONFIG_TYPE_NUMBER);
option->value.numeric = (int)(ci->values[1].value.number + .5);
} else {
assert(ci->values[1].type == OCONFIG_TYPE_NUMBER);
option->value.numeric = (int)(ci->values[1].value.number + .5);
status = cf_util_get_string(child, &db->host);
else if (strcasecmp("Interval", child->key) == 0)
status = cf_util_get_cdtime(child, &db->interval);
status = cf_util_get_string(child, &db->host);
else if (strcasecmp("Interval", child->key) == 0)
status = cf_util_get_cdtime(child, &db->interval);
- DEBUG("cdbi_read_database_query (%s, %s): There are %zu columns.", db->name,
- udb_query_get_name(q), column_num);
+ DEBUG("cdbi_read_database_query (%s, %s): There are %" PRIsz " columns.",
+ db->name, udb_query_get_name(q), column_num);
column_name = dbi_result_get_field_name(res, (unsigned int)(i + 1));
if (column_name == NULL) {
ERROR("dbi plugin: cdbi_read_database_query (%s, %s): "
column_name = dbi_result_get_field_name(res, (unsigned int)(i + 1));
if (column_name == NULL) {
ERROR("dbi plugin: cdbi_read_database_query (%s, %s): "
sstrncpy(column_names[i], column_name, DATA_MAX_NAME_LEN);
} /* }}} for (i = 0; i < column_num; i++) */
sstrncpy(column_names[i], column_name, DATA_MAX_NAME_LEN);
} /* }}} for (i = 0; i < column_num; i++) */
q, prep_area, (db->host ? db->host : hostname_g),
q, prep_area, (db->host ? db->host : hostname_g),
- /* plugin = */ "dbi", db->name, column_names, column_num,
+ /* plugin = */ (db->plugin_name != NULL) ? db->plugin_name : "dbi",
+ db->name, column_names, column_num,