From cedbf7117c6a9a1bb3a49b96ee6a376d8963698e Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 30 May 2016 23:29:05 +0200 Subject: [PATCH] curl stats: Use cf_util_get_boolean(). --- src/utils_curl_stats.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils_curl_stats.c b/src/utils_curl_stats.c index 0f2f56ea..ff2eb641 100644 --- a/src/utils_curl_stats.c +++ b/src/utils_curl_stats.c @@ -173,6 +173,8 @@ curl_stats_t *curl_stats_from_config (oconfig_item_t *ci) oconfig_item_t *c = ci->children + i; size_t field; + _Bool enabled = 0; + for (field = 0; field < STATIC_ARRAY_SIZE (field_specs); ++field) { if (! strcasecmp (c->key, field_specs[field].config_key)) break; @@ -186,14 +188,12 @@ curl_stats_t *curl_stats_from_config (oconfig_item_t *ci) return NULL; } - if ((c->values_num != 1) - || (c->values[0].type != OCONFIG_TYPE_BOOLEAN)) { - ERROR ("curl stats: `%s' expects a single boolean argument", c->key); + + if (cf_util_get_boolean (c, &enabled) != 0) { free (s); return NULL; } - - if (c->values[0].value.boolean) + if (enabled) enable_field (s, field_specs[field].offset); } -- 2.30.2