varnish plugin: Fix implicit cast from int to bool.
authorFlorian Forster <octo@collectd.org>
Wed, 2 Dec 2015 09:43:42 +0000 (10:43 +0100)
committerFlorian Forster <octo@collectd.org>
Wed, 2 Dec 2015 09:43:42 +0000 (10:43 +0100)
Also revert the inclusion of <stdbool.h> as per our coding guidelines.
The native C99 _Bool is used instead.

src/varnish.c

index 36908ff..65562d3 100644 (file)
@@ -23,7 +23,6 @@
  *   Florian octo Forster <octo at collectd.org>
  **/
 
-#include <stdbool.h>
 #include "collectd.h"
 #include "common.h"
 #include "plugin.h"
@@ -589,7 +588,7 @@ static int varnish_read (user_data_t *ud) /* {{{ */
 {
        struct VSM_data *vd;
        const c_varnish_stats_t *stats;
-       bool test;
+       _Bool ok;
 
        user_config_t *conf;
 
@@ -619,11 +618,11 @@ static int varnish_read (user_data_t *ud) /* {{{ */
        }
 
 #if HAVE_VARNISH_V3
-       test = VSC_Open (vd, /* diag = */ 1);
+       ok = (VSC_Open (vd, /* diag = */ 1) == 0);
 #else /* if HAVE_VARNISH_V4 */
-       test = VSM_Open (vd);
+       ok = (VSM_Open (vd) == 0);
 #endif
-       if (test)
+       if (!ok)
        {
                VSM_Delete (vd);
                ERROR ("varnish plugin: Unable to open connection.");