author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 31 Oct 2010 16:15:06 +0000 (17:15 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 31 Oct 2010 16:15:06 +0000 (17:15 +0100) |
src/collectd.h | patch | blob | history | |
src/df.c | patch | blob | history | |
src/network.c | patch | blob | history | |
src/perl.c | patch | blob | history | |
src/plugin.c | patch | blob | history | |
src/plugin.h | patch | blob | history | |
src/rrdtool.c | patch | blob | history |
diff --git a/src/collectd.h b/src/collectd.h
index 4c347ddc10f2b2637e13c5693f64b7083c8df374..7012f4d13f9261348f476495f67e8ffe0343ca9a 100644 (file)
--- a/src/collectd.h
+++ b/src/collectd.h
#if HAVE_STDINT_H
# include <stdint.h>
#endif
-#if HAVE_STDBOOL_H
-# include <stdbool.h>
-#else
-# ifndef HAVE__BOOL
-# ifdef __cplusplus
-typedef bool _Bool;
-# else
-# define _Bool signed char
-# endif
-# endif
-# define bool _Bool
-# define false 0
-# define true 1
-# define __bool_true_false_are_defined 1
-#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
diff --git a/src/df.c b/src/df.c
index b2be8e5eb77a40f55abb499934956eaefe05a3f7..4b3cba019cea9219289cc8adef7633a05e30a9ba 100644 (file)
--- a/src/df.c
+++ b/src/df.c
static ignorelist_t *il_mountpoint = NULL;
static ignorelist_t *il_fstype = NULL;
-static _Bool by_device = false;
-static _Bool report_inodes = false;
+static _Bool by_device = 0;
+static _Bool report_inodes = 0;
static int df_init (void)
{
else if (strcasecmp (key, "ReportByDevice") == 0)
{
if (IS_TRUE (value))
- by_device = true;
+ by_device = 1;
return (0);
}
else if (strcasecmp (key, "ReportInodes") == 0)
{
if (IS_TRUE (value))
- report_inodes = true;
+ report_inodes = 1;
else
- report_inodes = false;
+ report_inodes = 0;
return (0);
}
diff --git a/src/network.c b/src/network.c
index 94856b40e62b4eebb25e61f6a4b313943ae6b584..6d53504c2ae6b2d4b4404c645e4b30424d149042 100644 (file)
--- a/src/network.c
+++ b/src/network.c
/* This is a value we already sent. Don't allow it to be received again in
* order to avoid looping. */
if ((status == 0) && (time_sent >= ((uint64_t) vl->time)))
- return (false);
+ return (0);
- return (true);
+ return (1);
} /* }}} _Bool check_receive_okay */
static _Bool check_send_okay (const value_list_t *vl) /* {{{ */
{
- _Bool received = false;
+ _Bool received = 0;
int status;
if (network_config_forward != 0)
- return (true);
+ return (1);
if (vl->meta == NULL)
- return (true);
+ return (1);
status = meta_data_get_boolean (vl->meta, "network:received", &received);
if (status == -ENOENT)
- return (true);
+ return (1);
else if (status != 0)
{
ERROR ("network plugin: check_send_okay: meta_data_get_boolean failed "
"with status %i.", status);
- return (true);
+ return (1);
}
/* By default, only *send* value lists that were not *received* by the
return (-ENOMEM);
}
- status = meta_data_add_boolean (vl->meta, "network:received", true);
+ status = meta_data_add_boolean (vl->meta, "network:received", 1);
if (status != 0)
{
ERROR ("network plugin: meta_data_add_boolean failed.");
static int network_init (void)
{
- static _Bool have_init = false;
+ static _Bool have_init = 0;
/* Check if we were already initialized. If so, just return - there's
* nothing more to do (for now, that is). */
if (have_init)
return (0);
- have_init = true;
+ have_init = 1;
#if HAVE_LIBGCRYPT
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
diff --git a/src/perl.c b/src/perl.c
index c82d16b65e92e5efbc933c26d6138197f3abc156..116c34f363d535b2d644ee73add242804be3465d 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
#include "configfile.h"
+#if HAVE_STDBOOL_H
+# include <stdbool.h>
+#endif
+
#include <EXTERN.h>
#include <perl.h>
diff --git a/src/plugin.c b/src/plugin.c
index fb77a134e09aa60bfcefa441539a64d3377f749f..83582763a5f72ece4c2cac586bcf01f2a0a7bede 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
}
case NM_TYPE_BOOLEAN:
{
- meta->nm_value.nm_boolean = *((bool *) value);
+ meta->nm_value.nm_boolean = *((_Bool *) value);
break;
}
default:
int plugin_notification_meta_add_boolean (notification_t *n,
const char *name,
- bool value)
+ _Bool value)
{
return (plugin_notification_meta_add (n, name, NM_TYPE_BOOLEAN, &value));
}
diff --git a/src/plugin.h b/src/plugin.h
index eb9f81f8c4908ab793593f54585cdbc882f5302b..ada89322bbd0f4fc8db3edab7294d1db6da0a7aa 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
int64_t nm_signed_int;
uint64_t nm_unsigned_int;
double nm_double;
- bool nm_boolean;
+ _Bool nm_boolean;
} nm_value;
struct notification_meta_s *next;
} notification_meta_t;
double value);
int plugin_notification_meta_add_boolean (notification_t *n,
const char *name,
- bool value);
+ _Bool value);
int plugin_notification_meta_copy (notification_t *dst,
const notification_t *src);
diff --git a/src/rrdtool.c b/src/rrdtool.c
index ca5441a8d71ec093d1052cd16084307d59f2db69..bd7bd77bd697b8025aaa0bb67d624bca84f98134 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
pthread_mutex_lock (&queue_lock);
/* Wait for values to arrive */
- while (true)
+ while (42)
{
struct timespec ts_wait;
&ts_wait);
if (status == ETIMEDOUT)
break;
- } /* while (true) */
+ } /* while (42) */
/* XXX: If you need to lock both, cache_lock and queue_lock, at
* the same time, ALWAYS lock `cache_lock' first! */