]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
bind: fix warning for variable used only in DEBUG() calls
authorEero Tamminen <eero.t.tamminen@intel.com>
Mon, 6 May 2024 08:48:33 +0000 (11:48 +0300)
committerMatthias Runge <mrunge@matthias-runge.de>
Tue, 7 May 2024 07:35:11 +0000 (09:35 +0200)
Fixes: https://github.com/collectd/collectd/issues/4305
Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/bind.c

index 4a7c024253527aa84b6d219f0c9b623f123f5c98..590287837575e22ac3067ef7c295851ec0fb37d9 100644 (file)
@@ -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);
     }