summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ecacce8)
raw | patch | inline | side by side (parent: ecacce8)
author | Florian Forster <octo@collectd.org> | |
Fri, 19 Jun 2015 08:54:02 +0000 (10:54 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 19 Jun 2015 08:57:04 +0000 (10:57 +0200) |
While at it, replace the powerdns_config_add_string() function.
src/powerdns.c | patch | blob | history |
diff --git a/src/powerdns.c b/src/powerdns.c
index 11974aaafdcb2122ad31f8c5d42bc9a81cfed645..c8e72cbff8965f0d886a328937618ec2fbb7a58a 100644 (file)
--- a/src/powerdns.c
+++ b/src/powerdns.c
return (0);
} /* }}} int powerdns_read_recursor */
-static int powerdns_config_add_string (const char *name, /* {{{ */
- char **dest,
- oconfig_item_t *ci)
-{
- if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
- {
- WARNING ("powerdns plugin: `%s' needs exactly one string argument.",
- name);
- return (-1);
- }
-
- sfree (*dest);
- *dest = strdup (ci->values[0].value.string);
- if (*dest == NULL)
- return (-1);
-
- return (0);
-} /* }}} int powerdns_config_add_string */
-
static int powerdns_config_add_collect (list_item_t *li, /* {{{ */
oconfig_item_t *ci)
{
if (strcasecmp ("Collect", option->key) == 0)
status = powerdns_config_add_collect (item, option);
else if (strcasecmp ("Socket", option->key) == 0)
- status = powerdns_config_add_string ("Socket", &socket_temp, option);
+ status = cf_util_get_string (option, &socket_temp);
else
{
ERROR ("powerdns plugin: Option `%s' not allowed here.", option->key);
if (status != 0)
{
+ sfree (socket_temp);
sfree (item);
return (-1);
}
DEBUG ("powerdns plugin: Add server: instance = %s;", item->instance);
+ sfree (socket_temp);
return (0);
} /* }}} int powerdns_config_add_server */