summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d0efcb2)
raw | patch | inline | side by side (parent: d0efcb2)
author | Florian Forster <octo@collectd.org> | |
Mon, 6 Feb 2012 17:07:08 +0000 (18:07 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Mon, 6 Feb 2012 17:07:08 +0000 (18:07 +0100) |
PostgreSQL plugin: Also abolish the config_set_s() function in favor of
cf_util_get_string().
Change-Id: Ib3d903c48a30fd6a8417e8ee999368eda15d69d7
cf_util_get_string().
Change-Id: Ib3d903c48a30fd6a8417e8ee999368eda15d69d7
src/pinba.c | patch | blob | history | |
src/postgresql.c | patch | blob | history | |
src/routeros.c | patch | blob | history |
diff --git a/src/pinba.c b/src/pinba.c
index a6fd06fe2d56352a0a7e29cba18b394dd32559d2..26aa539b413a2fefcddeec0734e18c5f65dc0f68 100644 (file)
--- a/src/pinba.c
+++ b/src/pinba.c
if (strcasecmp ("Address", child->key) == 0)
cf_util_get_string (child, &conf_node);
else if (strcasecmp ("Port", child->key) == 0)
- cf_util_get_string (child, &conf_service);
+ cf_util_get_service (child, &conf_service);
else if (strcasecmp ("View", child->key) == 0)
pinba_config_view (child);
else
diff --git a/src/postgresql.c b/src/postgresql.c
index a8812e2158327bf86153689894e8eada7e620022..0a5e66c25d934acd4de939cd049e6070a3121ca9 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
return 0;
} /* c_psql_shutdown */
-static int config_set_s (char *name, char **var, const oconfig_item_t *ci)
-{
- if ((0 != ci->children_num) || (1 != ci->values_num)
- || (OCONFIG_TYPE_STRING != ci->values[0].type)) {
- log_err ("%s expects a single string argument.", name);
- return 1;
- }
-
- sfree (*var);
- *var = sstrdup (ci->values[0].value.string);
- return 0;
-} /* config_set_s */
-
static int config_query_param_add (udb_query_t *q, oconfig_item_t *ci)
{
c_psql_user_data_t *data;
oconfig_item_t *c = ci->children + i;
if (0 == strcasecmp (c->key, "Host"))
- config_set_s ("Host", &db->host, c);
+ cf_util_get_string (c, &db->host);
else if (0 == strcasecmp (c->key, "Port"))
- config_set_s ("Port", &db->port, c);
+ cf_util_get_service (c, &db->port);
else if (0 == strcasecmp (c->key, "User"))
- config_set_s ("User", &db->user, c);
+ cf_util_get_string (c, &db->user);
else if (0 == strcasecmp (c->key, "Password"))
- config_set_s ("Password", &db->password, c);
+ cf_util_get_string (c, &db->password);
else if (0 == strcasecmp (c->key, "SSLMode"))
- config_set_s ("SSLMode", &db->sslmode, c);
+ cf_util_get_string (c, &db->sslmode);
else if (0 == strcasecmp (c->key, "KRBSrvName"))
- config_set_s ("KRBSrvName", &db->krbsrvname, c);
+ cf_util_get_string (c, &db->krbsrvname);
else if (0 == strcasecmp (c->key, "Service"))
- config_set_s ("Service", &db->service, c);
+ cf_util_get_string (c, &db->service);
else if (0 == strcasecmp (c->key, "Query"))
udb_query_pick_from_list (c, queries, queries_num,
&db->queries, &db->queries_num);
diff --git a/src/routeros.c b/src/routeros.c
index d61ffe984d36cfa2eaa3b74efce9872abdc9d648..2ade3bb9c9d2cceb90a71f8950353dd214f2c80a 100644 (file)
--- a/src/routeros.c
+++ b/src/routeros.c
if (strcasecmp ("Host", child->key) == 0)
status = cf_util_get_string (child, &router_data->node);
else if (strcasecmp ("Port", child->key) == 0)
- status = cf_util_get_string (child, &router_data->service);
+ status = cf_util_get_service (child, &router_data->service);
else if (strcasecmp ("User", child->key) == 0)
status = cf_util_get_string (child, &router_data->username);
else if (strcasecmp ("Password", child->key) == 0)