From: Eero Tamminen Date: Mon, 6 May 2024 08:48:33 +0000 (+0300) Subject: bind: fix warning for variable used only in DEBUG() calls X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d29f1d0447292674180b225cd6df0a0eb38b784;p=thirdparty%2Fcollectd.git bind: fix warning for variable used only in DEBUG() calls Fixes: https://github.com/collectd/collectd/issues/4305 Signed-off-by: Eero Tamminen --- diff --git a/src/bind.c b/src/bind.c index 4a7c02425..590287837 100644 --- a/src/bind.c +++ b/src/bind.c @@ -470,7 +470,9 @@ static int bind_parse_generic_name_value(const char *xpath_expression, /* {{{ */ return -1; } +#if COLLECT_DEBUG int num_entries = 0; +#endif /* Iterate over all matching nodes. */ for (int i = 0; xpathObj->nodesetval && (i < xpathObj->nodesetval->nodeNr); i++) { @@ -510,8 +512,10 @@ static int bind_parse_generic_name_value(const char *xpath_expression, /* {{{ */ } status = (*list_callback)(name, value, current_time, user_data); +#if COLLECT_DEBUG if (status == 0) num_entries++; +#endif xmlFree(name); } @@ -549,7 +553,9 @@ static int bind_parse_generic_value_list(const char *xpath_expression, /* {{{ */ return -1; } +#if COLLECT_DEBUG int num_entries = 0; +#endif /* Iterate over all matching nodes. */ for (int i = 0; xpathObj->nodesetval && (i < xpathObj->nodesetval->nodeNr); i++) { @@ -572,8 +578,10 @@ static int bind_parse_generic_value_list(const char *xpath_expression, /* {{{ */ continue; status = (*list_callback)(node_name, value, current_time, user_data); +#if COLLECT_DEBUG if (status == 0) num_entries++; +#endif } } @@ -609,7 +617,9 @@ static int bind_parse_generic_name_attr_value_list( return -1; } +#if COLLECT_DEBUG int num_entries = 0; +#endif /* Iterate over all matching nodes. */ for (int i = 0; xpathObj->nodesetval && (i < xpathObj->nodesetval->nodeNr); i++) { @@ -641,8 +651,10 @@ static int bind_parse_generic_name_attr_value_list( } status = (*list_callback)(attr_name, value, current_time, user_data); +#if COLLECT_DEBUG if (status == 0) num_entries++; +#endif xmlFree(attr_name); }