X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fgmond.c;h=2bca05adc0235ec758db3f5e30e4966f499dbe37;hb=7c9d772c992647fcba64a96800c146eb9f1647f8;hp=ca654194f6d277c9bacc4c2c758aefcd65dca018;hpb=b9b5e5d573d0011c4f3276e9b84b73ba4dd2e870;p=collectd.git diff --git a/src/gmond.c b/src/gmond.c index ca654194..2bca05ad 100644 --- a/src/gmond.c +++ b/src/gmond.c @@ -833,28 +833,6 @@ static int mc_receive_thread_stop(void) /* {{{ */ * * */ -static int gmond_config_set_string(oconfig_item_t *ci, char **str) /* {{{ */ -{ - char *tmp; - - if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) { - WARNING("gmond plugin: The `%s' option needs " - "exactly one string argument.", - ci->key); - return -1; - } - - tmp = strdup(ci->values[0].value.string); - if (tmp == NULL) { - ERROR("gmond plugin: strdup failed."); - return -1; - } - - sfree(*str); - *str = tmp; - return 0; -} /* }}} int gmond_config_set_string */ - static int gmond_config_add_metric(oconfig_item_t *ci) /* {{{ */ { metric_map_t *map; @@ -889,11 +867,11 @@ static int gmond_config_add_metric(oconfig_item_t *ci) /* {{{ */ for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; if (strcasecmp("Type", child->key) == 0) - gmond_config_set_string(child, &map->type); + cf_util_get_string(child, &map->type); else if (strcasecmp("TypeInstance", child->key) == 0) - gmond_config_set_string(child, &map->type_instance); + cf_util_get_string(child, &map->type_instance); else if (strcasecmp("DataSource", child->key) == 0) - gmond_config_set_string(child, &map->ds_name); + cf_util_get_string(child, &map->ds_name); else { WARNING("gmond plugin: Unknown configuration option `%s' ignored.", child->key);