From 61a4ed99b1a5b6d371bb745933d0efc5dff9505c Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sun, 13 May 2018 18:35:29 +0200 Subject: [PATCH] Treewide: use bool instead of _Bool It's about time --- src/aggregation.c | 20 ++++++------ src/amqp.c | 18 +++++------ src/apache.c | 4 +-- src/apcups.c | 6 ++-- src/barometer.c | 6 ++-- src/battery.c | 12 +++---- src/bind.c | 2 +- src/ceph.c | 6 ++-- src/ceph_test.c | 2 +- src/cgroups.c | 2 +- src/collectd-nagios.c | 3 +- src/collectd-tg.c | 3 +- src/cpu.c | 14 ++++---- src/curl.c | 10 +++--- src/curl_json.c | 8 ++--- src/curl_xml.c | 6 ++-- src/daemon/collectd.c | 10 +++--- src/daemon/collectd.h | 1 + src/daemon/common.c | 2 +- src/daemon/common.h | 2 +- src/daemon/configfile.c | 10 +++--- src/daemon/configfile.h | 4 +-- src/daemon/meta_data.c | 6 ++-- src/daemon/meta_data.h | 4 +-- src/daemon/meta_data_test.c | 2 +- src/daemon/plugin.c | 24 +++++++------- src/daemon/plugin.h | 8 ++--- src/daemon/plugin_mock.c | 2 +- src/daemon/utils_cache.c | 4 +-- src/daemon/utils_cache.h | 4 +-- src/daemon/utils_complain.h | 2 +- src/daemon/utils_random.c | 2 +- src/daemon/utils_time.c | 6 ++-- src/dbi.c | 2 +- src/df.c | 8 ++--- src/disk.c | 8 ++--- src/dpdkevents.c | 8 ++--- src/ethstat.c | 2 +- src/fhcount.c | 4 +-- src/grpc.cc | 2 +- src/hugepages.c | 10 +++--- src/intel_pmu.c | 6 ++-- src/interface.c | 4 +-- src/ipmi.c | 20 ++++++------ src/libcollectdclient/network_buffer.c | 9 +++--- src/libcollectdclient/network_parse.c | 1 + src/libcollectdclient/server.c | 5 +-- src/load.c | 2 +- src/log_logstash.c | 2 +- src/logfile.c | 2 +- src/lpar.c | 6 ++-- src/match_regex.c | 2 +- src/mcelog.c | 6 ++-- src/memcached.c | 4 +-- src/memory.c | 6 ++-- src/mic.c | 10 +++--- src/modbus.c | 2 +- src/mqtt.c | 12 +++---- src/mysql.c | 16 +++++----- src/netapp.c | 2 +- src/netlink.c | 2 +- src/network.c | 30 +++++++++--------- src/nfs.c | 6 ++-- src/ntpd.c | 6 ++-- src/onewire.c | 4 +-- src/openldap.c | 4 +-- src/openvpn.c | 12 +++---- src/ovs_events.c | 8 ++--- src/perl.c | 8 ++--- src/pf.c | 2 +- src/pinba.c | 4 +-- src/ping.c | 2 +- src/postgresql.c | 12 +++---- src/processes.c | 34 ++++++++++---------- src/python.c | 6 ++-- src/pyvalues.c | 4 +-- src/routeros.c | 12 +++---- src/rrdcached.c | 10 +++--- src/sensors.c | 2 +- src/serial.c | 2 +- src/snmp.c | 16 +++++----- src/snmp_agent.c | 2 +- src/statsd.c | 24 +++++++------- src/swap.c | 14 ++++---- src/tail_csv.c | 4 +-- src/target_replace.c | 8 ++--- src/target_v5upgrade.c | 2 +- src/testing.h | 2 +- src/thermal.c | 4 +-- src/turbostat.c | 40 +++++++++++------------ src/unixsock.c | 2 +- src/utils_cmds_test.c | 2 +- src/utils_curl_stats.c | 2 +- src/utils_format_graphite.c | 4 +-- src/utils_format_json.c | 2 +- src/utils_format_json_test.c | 2 +- src/utils_latency_config.h | 6 ++-- src/utils_ovs.c | 2 +- src/utils_rrdcreate.h | 2 +- src/utils_vl_lookup.c | 8 ++--- src/utils_vl_lookup_test.c | 6 ++-- src/varnish.c | 58 +++++++++++++++++----------------- src/virt.c | 4 +-- src/write_graphite.c | 4 +-- src/write_http.c | 12 +++---- src/write_kafka.c | 2 +- src/write_log.c | 2 +- src/write_mongodb.c | 6 ++-- src/write_prometheus.c | 4 +-- src/write_redis.c | 2 +- src/write_riemann.c | 10 +++--- src/write_sensu.c | 8 ++--- src/write_tsdb.c | 8 ++--- 113 files changed, 413 insertions(+), 407 deletions(-) diff --git a/src/aggregation.c b/src/aggregation.c index 3317ce9c..8cd91d4f 100644 --- a/src/aggregation.c +++ b/src/aggregation.c @@ -48,12 +48,12 @@ struct aggregation_s /* {{{ */ char *set_plugin_instance; char *set_type_instance; - _Bool calc_num; - _Bool calc_sum; - _Bool calc_average; - _Bool calc_min; - _Bool calc_max; - _Bool calc_stddev; + bool calc_num; + bool calc_sum; + bool calc_average; + bool calc_min; + bool calc_max; + bool calc_stddev; }; /* }}} */ typedef struct aggregation_s aggregation_t; @@ -88,7 +88,7 @@ static lookup_t *lookup = NULL; static pthread_mutex_t agg_instance_list_lock = PTHREAD_MUTEX_INITIALIZER; static agg_instance_t *agg_instance_list_head = NULL; -static _Bool agg_is_regex(char const *str) /* {{{ */ +static bool agg_is_regex(char const *str) /* {{{ */ { if (str == NULL) return 0; @@ -101,7 +101,7 @@ static _Bool agg_is_regex(char const *str) /* {{{ */ return 1; else return 0; -} /* }}} _Bool agg_is_regex */ +} /* }}} bool agg_is_regex */ static void agg_destroy(aggregation_t *agg) /* {{{ */ { @@ -570,7 +570,7 @@ static int agg_config_aggregation(oconfig_item_t *ci) /* {{{ */ agg->regex_fields |= LU_GROUP_BY_TYPE_INSTANCE; /* Sanity checking */ - _Bool is_valid = 1; + bool is_valid = 1; if (strcmp("/.*/", agg->ident.type) == 0) /* {{{ */ { ERROR("aggregation plugin: It appears you did not specify the required " @@ -711,7 +711,7 @@ static int agg_read(void) /* {{{ */ static int agg_write(data_set_t const *ds, value_list_t const *vl, /* {{{ */ __attribute__((unused)) user_data_t *user_data) { - _Bool created_by_aggregation = 0; + bool created_by_aggregation = 0; /* Ignore values that were created by the aggregation plugin to avoid weird * effects. */ (void)meta_data_get_boolean(vl->meta, "aggregation:created", diff --git a/src/amqp.c b/src/amqp.c index 6c184488..50711014 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -66,7 +66,7 @@ int amqp_socket_close(amqp_socket_t *); * Data types */ struct camqp_config_s { - _Bool publish; + bool publish; char *name; char *host; @@ -83,7 +83,7 @@ struct camqp_config_s { /* publish only */ uint8_t delivery_mode; - _Bool store_rates; + bool store_rates; int format; /* publish & graphite format only */ char *prefix; @@ -94,8 +94,8 @@ struct camqp_config_s { /* subscribe only */ char *exchange_type; char *queue; - _Bool queue_durable; - _Bool queue_auto_delete; + bool queue_durable; + bool queue_auto_delete; amqp_connection_state_t connection; pthread_mutex_t lock; @@ -113,7 +113,7 @@ static const char *def_exchange = "amq.fanout"; static pthread_t *subscriber_threads = NULL; static size_t subscriber_threads_num = 0; -static _Bool subscriber_threads_running = 1; +static bool subscriber_threads_running = 1; #define CONF(c, f) (((c)->f != NULL) ? (c)->f : def_##f) @@ -176,7 +176,7 @@ static char *camqp_bytes_cstring(amqp_bytes_t *in) /* {{{ */ return ret; } /* }}} char *camqp_bytes_cstring */ -static _Bool camqp_is_error(camqp_config_t *conf) /* {{{ */ +static bool camqp_is_error(camqp_config_t *conf) /* {{{ */ { amqp_rpc_reply_t r; @@ -185,7 +185,7 @@ static _Bool camqp_is_error(camqp_config_t *conf) /* {{{ */ return 0; return 1; -} /* }}} _Bool camqp_is_error */ +} /* }}} bool camqp_is_error */ static char *camqp_strerror(camqp_config_t *conf, /* {{{ */ char *buffer, size_t buffer_size) { @@ -825,7 +825,7 @@ static int camqp_config_set_format(oconfig_item_t *ci, /* {{{ */ } /* }}} int config_set_string */ static int camqp_config_connection(oconfig_item_t *ci, /* {{{ */ - _Bool publish) { + bool publish) { camqp_config_t *conf; int status; @@ -902,7 +902,7 @@ static int camqp_config_connection(oconfig_item_t *ci, /* {{{ */ else if (strcasecmp("RoutingKey", child->key) == 0) status = cf_util_get_string(child, &conf->routing_key); else if ((strcasecmp("Persistent", child->key) == 0) && publish) { - _Bool tmp = 0; + bool tmp = 0; status = cf_util_get_boolean(child, &tmp); if (tmp) conf->delivery_mode = CAMQP_DM_PERSISTENT; diff --git a/src/apache.c b/src/apache.c index 5247cd96..5ebd0441 100644 --- a/src/apache.c +++ b/src/apache.c @@ -40,8 +40,8 @@ struct apache_s { char *url; char *user; char *pass; - _Bool verify_peer; - _Bool verify_host; + bool verify_peer; + bool verify_host; char *cacert; char *ssl_ciphers; char *server; /* user specific server type */ diff --git a/src/apcups.c b/src/apcups.c index 262fa424..2fa24799 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -73,8 +73,8 @@ typedef struct { static char *conf_node = NULL; static char *conf_service = NULL; /* Defaults to false for backwards compatibility. */ -static _Bool conf_report_seconds = 0; -static _Bool conf_persistent_conn = 1; +static bool conf_report_seconds = 0; +static bool conf_persistent_conn = 1; static int global_sockfd = -1; @@ -347,7 +347,7 @@ static int apc_query_server(char const *node, char const *service, } static int apcups_config(oconfig_item_t *ci) { - _Bool persistent_conn_set = 0; + bool persistent_conn_set = 0; for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; diff --git a/src/barometer.c b/src/barometer.c index 6c6347c9..be8198ac 100644 --- a/src/barometer.c +++ b/src/barometer.c @@ -186,7 +186,7 @@ static double config_temp_offset = 0.0; /**< temperature offset */ static double config_altitude = NAN; /**< altitude */ static int config_normalize = 0; /**< normalization method */ -static _Bool configured = 0; /**< the whole plugin config status */ +static bool configured = 0; /**< the whole plugin config status */ static int i2c_bus_fd = -1; /**< I2C bus device FD */ @@ -226,7 +226,7 @@ static short bmp085_MD; /* Used only for MPL115. MPL3115 supports real oversampling in the device so */ /* no need for any postprocessing. */ -static _Bool avg_initialized = 0; /**< already initialized by real values */ +static bool avg_initialized = 0; /**< already initialized by real values */ typedef struct averaging_s { long int *ring_buffer; @@ -313,7 +313,7 @@ static double averaging_add_sample(averaging_t *avg, long int sample) { typedef struct temperature_list_s { char *sensor_name; /**< sensor name/reference */ size_t num_values; /**< number of values (usually one) */ - _Bool initialized; /**< sensor already provides data */ + bool initialized; /**< sensor already provides data */ struct temperature_list_s *next; /**< next in the list */ } temperature_list_t; diff --git a/src/battery.c b/src/battery.c index b6dea0f3..74e27961 100644 --- a/src/battery.c +++ b/src/battery.c @@ -72,9 +72,9 @@ int battery_read_statefs( void); /* defined in battery_statefs; used by StateFS backend */ -static _Bool report_percent = 0; -static _Bool report_degraded = 0; -static _Bool query_statefs = 0; +static bool report_percent = 0; +static bool report_degraded = 0; +static bool query_statefs = 0; static void battery_submit2(char const *plugin_instance, /* {{{ */ char const *type, char const *type_instance, @@ -410,7 +410,7 @@ static int read_sysfs_callback(char const *dir, /* {{{ */ char const *plugin_instance; char buffer[32]; gauge_t v = NAN; - _Bool discharging = 0; + bool discharging = 0; int status; /* Ignore non-battery directories, such as AC power. */ @@ -522,8 +522,8 @@ static int read_acpi_callback(char const *dir, /* {{{ */ gauge_t capacity_charged = NAN; gauge_t capacity_full = NAN; gauge_t capacity_design = NAN; - _Bool charging = 0; - _Bool is_current = 0; + bool charging = 0; + bool is_current = 0; char const *plugin_instance; char filename[PATH_MAX]; diff --git a/src/bind.c b/src/bind.c index ab501de6..5937d267 100644 --- a/src/bind.c +++ b/src/bind.c @@ -104,7 +104,7 @@ typedef struct list_info_ptr_s list_info_ptr_t; /* FIXME: Enabled by default for backwards compatibility. */ /* TODO: Remove time parsing code. */ -static _Bool config_parse_time = 1; +static bool config_parse_time = 1; static char *url = NULL; static int global_opcodes = 1; diff --git a/src/ceph.c b/src/ceph.c index df4a720e..9027771e 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -404,8 +404,8 @@ static int compact_ds_name(char *buffer, size_t buffer_size, char const *src) { size_t src_len; char *ptr = buffer; size_t ptr_size = buffer_size; - _Bool append_plus = 0; - _Bool append_minus = 0; + bool append_plus = 0; + bool append_minus = 0; if ((buffer == NULL) || (buffer_size <= strlen("Minus")) || (src == NULL)) return EINVAL; @@ -470,7 +470,7 @@ static int compact_ds_name(char *buffer, size_t buffer_size, char const *src) { return 0; } -static _Bool has_suffix(char const *str, char const *suffix) { +static bool has_suffix(char const *str, char const *suffix) { size_t str_len = strlen(str); size_t suffix_len = strlen(suffix); size_t offset; diff --git a/src/ceph_test.c b/src/ceph_test.c index 45467730..b3c8f0bc 100644 --- a/src/ceph_test.c +++ b/src/ceph_test.c @@ -39,7 +39,7 @@ static int test_handler(void *user, char const *val, char const *key) { size_t i; char status[1024]; - _Bool ok; + bool ok; /* special case for latency metrics. */ if (strcmp("filestore.example_latency", key) == 0) diff --git a/src/cgroups.c b/src/cgroups.c index 4f34b3a9..103e70f6 100644 --- a/src/cgroups.c +++ b/src/cgroups.c @@ -181,7 +181,7 @@ static int cgroups_config(const char *key, const char *value) { static int cgroups_read(void) { cu_mount_t *mnt_list = NULL; - _Bool cgroup_found = 0; + bool cgroup_found = 0; if (cu_mount_getlist(&mnt_list) == NULL) { ERROR("cgroups plugin: cu_mount_getlist failed."); diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c index 89f73b83..27d5622f 100644 --- a/src/collectd-nagios.c +++ b/src/collectd-nagios.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -100,7 +101,7 @@ static char *hostname_g = NULL; static range_t range_critical_g; static range_t range_warning_g; static int consolitation_g = CON_NONE; -static _Bool nan_is_error_g = 0; +static bool nan_is_error_g = 0; static char **match_ds_g = NULL; static size_t match_ds_num_g = 0; diff --git a/src/collectd-tg.c b/src/collectd-tg.c index 48f2dc43..85c5c1b6 100644 --- a/src/collectd-tg.c +++ b/src/collectd-tg.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -66,7 +67,7 @@ static c_heap_t *values_heap = NULL; static struct sigaction sigint_action; static struct sigaction sigterm_action; -static _Bool loop = 1; +static bool loop = 1; __attribute__((noreturn)) static void exit_usage(int exit_status) /* {{{ */ { diff --git a/src/cpu.c b/src/cpu.c index 8480f11a..42fcbed9 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -183,7 +183,7 @@ static int pnumcpu; struct cpu_state_s { value_to_rate_state_t conv; gauge_t rate; - _Bool has_value; + bool has_value; }; typedef struct cpu_state_s cpu_state_t; @@ -194,12 +194,12 @@ static size_t cpu_states_num = 0; /* #cpu_states allocated */ * determine how many CPUs there were. Reset to 0 by cpu_reset(). */ static size_t global_cpu_num = 0; -static _Bool report_by_cpu = 1; -static _Bool report_by_state = 1; -static _Bool report_percent = 0; -static _Bool report_num_cpu = 0; -static _Bool report_guest = 0; -static _Bool subtract_guest = 1; +static bool report_by_cpu = 1; +static bool report_by_state = 1; +static bool report_percent = 0; +static bool report_num_cpu = 0; +static bool report_guest = 0; +static bool subtract_guest = 1; static const char *config_keys[] = {"ReportByCpu", "ReportByState", "ReportNumCpu", "ValuesPercentage", diff --git a/src/curl.c b/src/curl.c index 35ec1f83..12bf8cd5 100644 --- a/src/curl.c +++ b/src/curl.c @@ -60,14 +60,14 @@ struct web_page_s /* {{{ */ char *user; char *pass; char *credentials; - _Bool digest; - _Bool verify_peer; - _Bool verify_host; + bool digest; + bool verify_peer; + bool verify_host; char *cacert; struct curl_slist *headers; char *post_body; - _Bool response_time; - _Bool response_code; + bool response_time; + bool response_code; int timeout; curl_stats_t *stats; diff --git a/src/curl_json.c b/src/curl_json.c index 09a606a8..1a1136a9 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -74,7 +74,7 @@ typedef struct { * exists for this part of the JSON structure. */ typedef struct { cj_tree_entry_t *entry; - _Bool in_array; + bool in_array; int index; char name[DATA_MAX_NAME_LEN]; } cj_state_t; @@ -91,9 +91,9 @@ struct cj_s /* {{{ */ char *user; char *pass; char *credentials; - _Bool digest; - _Bool verify_peer; - _Bool verify_host; + bool digest; + bool verify_peer; + bool verify_host; char *cacert; struct curl_slist *headers; char *post_body; diff --git a/src/curl_xml.c b/src/curl_xml.c index 19ae5f46..654bb671 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -79,9 +79,9 @@ struct cx_s /* {{{ */ char *user; char *pass; char *credentials; - _Bool digest; - _Bool verify_peer; - _Bool verify_host; + bool digest; + bool verify_peer; + bool verify_host; char *cacert; char *post_body; int timeout; diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index e63c8466..133b49ec 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -156,7 +156,7 @@ static int init_global_variables(void) { return 0; } /* int init_global_variables */ -static int change_basedir(const char *orig_dir, _Bool create) { +static int change_basedir(const char *orig_dir, bool create) { char *dir; size_t dirlen; int status; @@ -442,11 +442,11 @@ static int notify_systemd(void) { #endif /* KERNEL_LINUX */ struct cmdline_config { - _Bool test_config; - _Bool test_readall; - _Bool create_basedir; + bool test_config; + bool test_readall; + bool create_basedir; const char *configfile; - _Bool daemonize; + bool daemonize; }; static void read_cmdline(int argc, char **argv, struct cmdline_config *config) { diff --git a/src/daemon/collectd.h b/src/daemon/collectd.h index 0558aa40..87f05a23 100644 --- a/src/daemon/collectd.h +++ b/src/daemon/collectd.h @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/src/daemon/common.c b/src/daemon/common.c index fbbb6085..582d6b23 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -857,7 +857,7 @@ int format_name(char *ret, int ret_len, const char *hostname, int format_values(char *ret, size_t ret_len, /* {{{ */ const data_set_t *ds, const value_list_t *vl, - _Bool store_rates) { + bool store_rates) { size_t offset = 0; int status; gauge_t *rates = NULL; diff --git a/src/daemon/common.h b/src/daemon/common.h index 0e2b1d87..db1b4650 100644 --- a/src/daemon/common.h +++ b/src/daemon/common.h @@ -319,7 +319,7 @@ int format_name(char *ret, int ret_len, const char *hostname, format_name(ret, ret_len, (vl)->host, (vl)->plugin, (vl)->plugin_instance, \ (vl)->type, (vl)->type_instance) int format_values(char *ret, size_t ret_len, const data_set_t *ds, - const value_list_t *vl, _Bool store_rates); + const value_list_t *vl, bool store_rates); int parse_identifier(char *str, char **ret_host, char **ret_plugin, char **ret_plugin_instance, char **ret_type, diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index e61128eb..97fe42b6 100644 --- a/src/daemon/configfile.c +++ b/src/daemon/configfile.c @@ -76,7 +76,7 @@ typedef struct cf_value_map_s { typedef struct cf_global_option_s { const char *key; char *value; - _Bool from_cli; /* value set from CLI */ + bool from_cli; /* value set from CLI */ const char *def; } cf_global_option_t; @@ -245,7 +245,7 @@ static int dispatch_value_plugindir(oconfig_item_t *ci) { static int dispatch_loadplugin(oconfig_item_t *ci) { const char *name; - _Bool global = 0; + bool global = 0; plugin_ctx_t ctx = {0}; plugin_ctx_t old_ctx; int ret_val; @@ -826,7 +826,7 @@ static oconfig_item_t *cf_read_generic(const char *path, const char *pattern, /* * Public functions */ -int global_option_set(const char *option, const char *value, _Bool from_cli) { +int global_option_set(const char *option, const char *value, bool from_cli) { int i; DEBUG("option = %s; value = %s;", option, value); @@ -1110,7 +1110,7 @@ int cf_util_get_double(const oconfig_item_t *ci, double *ret_value) /* {{{ */ return 0; } /* }}} int cf_util_get_double */ -int cf_util_get_boolean(const oconfig_item_t *ci, _Bool *ret_bool) /* {{{ */ +int cf_util_get_boolean(const oconfig_item_t *ci, bool *ret_bool) /* {{{ */ { if ((ci == NULL) || (ret_bool == NULL)) return EINVAL; @@ -1152,7 +1152,7 @@ int cf_util_get_boolean(const oconfig_item_t *ci, _Bool *ret_bool) /* {{{ */ int cf_util_get_flag(const oconfig_item_t *ci, /* {{{ */ unsigned int *ret_value, unsigned int flag) { int status; - _Bool b; + bool b; if (ret_value == NULL) return EINVAL; diff --git a/src/daemon/configfile.h b/src/daemon/configfile.h index 7cebb97e..108609cb 100644 --- a/src/daemon/configfile.h +++ b/src/daemon/configfile.h @@ -89,7 +89,7 @@ int cf_register_complex(const char *type, int (*callback)(oconfig_item_t *)); */ int cf_read(const char *filename); -int global_option_set(const char *option, const char *value, _Bool from_cli); +int global_option_set(const char *option, const char *value, bool from_cli); const char *global_option_get(const char *option); long global_option_get_long(const char *option, long default_value); @@ -115,7 +115,7 @@ int cf_util_get_double(const oconfig_item_t *ci, double *ret_value); /* Assures the config option is a boolean and assignes it to `ret_bool'. * Otherwise, `ret_bool' is not changed and non-zero is returned. */ -int cf_util_get_boolean(const oconfig_item_t *ci, _Bool *ret_bool); +int cf_util_get_boolean(const oconfig_item_t *ci, bool *ret_bool); /* Assures the config option is a boolean and set or unset the given flag in * `ret_value' as appropriate. Returns non-zero on error. */ diff --git a/src/daemon/meta_data.c b/src/daemon/meta_data.c index 4d59b712..08f682e9 100644 --- a/src/daemon/meta_data.c +++ b/src/daemon/meta_data.c @@ -40,7 +40,7 @@ union meta_value_u { int64_t mv_signed_int; uint64_t mv_unsigned_int; double mv_double; - _Bool mv_boolean; + bool mv_boolean; }; typedef union meta_value_u meta_value_t; @@ -524,7 +524,7 @@ int meta_data_add_double(meta_data_t *md, /* {{{ */ } /* }}} int meta_data_add_double */ int meta_data_add_boolean(meta_data_t *md, /* {{{ */ - const char *key, _Bool value) { + const char *key, bool value) { meta_entry_t *e; if ((md == NULL) || (key == NULL)) @@ -661,7 +661,7 @@ int meta_data_get_double(meta_data_t *md, /* {{{ */ } /* }}} int meta_data_get_double */ int meta_data_get_boolean(meta_data_t *md, /* {{{ */ - const char *key, _Bool *value) { + const char *key, bool *value) { meta_entry_t *e; if ((md == NULL) || (key == NULL) || (value == NULL)) diff --git a/src/daemon/meta_data.h b/src/daemon/meta_data.h index 50fdb8d6..203b1460 100644 --- a/src/daemon/meta_data.h +++ b/src/daemon/meta_data.h @@ -56,14 +56,14 @@ int meta_data_add_signed_int(meta_data_t *md, const char *key, int64_t value); int meta_data_add_unsigned_int(meta_data_t *md, const char *key, uint64_t value); int meta_data_add_double(meta_data_t *md, const char *key, double value); -int meta_data_add_boolean(meta_data_t *md, const char *key, _Bool value); +int meta_data_add_boolean(meta_data_t *md, const char *key, bool value); int meta_data_get_string(meta_data_t *md, const char *key, char **value); int meta_data_get_signed_int(meta_data_t *md, const char *key, int64_t *value); int meta_data_get_unsigned_int(meta_data_t *md, const char *key, uint64_t *value); int meta_data_get_double(meta_data_t *md, const char *key, double *value); -int meta_data_get_boolean(meta_data_t *md, const char *key, _Bool *value); +int meta_data_get_boolean(meta_data_t *md, const char *key, bool *value); /* Returns the value as a string, regardless of the type. */ int meta_data_as_string(meta_data_t *md, const char *key, char **value); diff --git a/src/daemon/meta_data_test.c b/src/daemon/meta_data_test.c index bcd457d4..99de13d9 100644 --- a/src/daemon/meta_data_test.c +++ b/src/daemon/meta_data_test.c @@ -37,7 +37,7 @@ DEF_TEST(base) { int64_t si; uint64_t ui; double d; - _Bool b; + bool b; CHECK_NOT_NULL(m = meta_data_create()); diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c index 438366c2..eb269587 100644 --- a/src/daemon/plugin.c +++ b/src/daemon/plugin.c @@ -126,20 +126,20 @@ static cdtime_t max_read_interval = DEFAULT_MAX_READ_INTERVAL; static write_queue_t *write_queue_head; static write_queue_t *write_queue_tail; static long write_queue_length = 0; -static _Bool write_loop = 1; +static bool write_loop = 1; static pthread_mutex_t write_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t write_cond = PTHREAD_COND_INITIALIZER; static pthread_t *write_threads = NULL; static size_t write_threads_num = 0; static pthread_key_t plugin_ctx_key; -static _Bool plugin_ctx_key_initialized = 0; +static bool plugin_ctx_key_initialized = 0; static long write_limit_high = 0; static long write_limit_low = 0; static derive_t stats_values_dropped = 0; -static _Bool record_statistics = 0; +static bool record_statistics = 0; /* * Static functions @@ -391,7 +391,7 @@ static int plugin_unregister(llist_t *list, const char *name) /* {{{ */ /* plugin_load_file loads the shared object "file" and calls its * "module_register" function. Returns zero on success, non-zero otherwise. */ -static int plugin_load_file(char const *file, _Bool global) { +static int plugin_load_file(char const *file, bool global) { int flags = RTLD_NOW; if (global) flags |= RTLD_GLOBAL; @@ -912,7 +912,7 @@ void plugin_set_dir(const char *dir) { ERROR("plugin_set_dir: strdup(\"%s\") failed", dir); } -static _Bool plugin_is_loaded(char const *name) { +static bool plugin_is_loaded(char const *name) { int status; if (plugins_loaded == NULL) @@ -954,7 +954,7 @@ static void plugin_free_loaded(void) { } #define BUFSIZE 512 -int plugin_load(char const *plugin_name, _Bool global) { +int plugin_load(char const *plugin_name, bool global) { DIR *dh; const char *dir; char filename[BUFSIZE] = ""; @@ -1890,7 +1890,7 @@ static int plugin_dispatch_values_internal(value_list_t *vl) { int status; static c_complain_t no_write_complaint = C_COMPLAIN_INIT_STATIC; - _Bool free_meta_data = 0; + bool free_meta_data = 0; assert(vl != NULL); @@ -2023,7 +2023,7 @@ static double get_drop_probability(void) /* {{{ */ return (double)pos / (double)size; } /* }}} double get_drop_probability */ -static _Bool check_drop_value(void) /* {{{ */ +static bool check_drop_value(void) /* {{{ */ { static cdtime_t last_message_time = 0; static pthread_mutex_t last_message_lock = PTHREAD_MUTEX_INITIALIZER; @@ -2061,7 +2061,7 @@ static _Bool check_drop_value(void) /* {{{ */ return 1; else return 0; -} /* }}} _Bool check_drop_value */ +} /* }}} bool check_drop_value */ int plugin_dispatch_values(value_list_t const *vl) { int status; @@ -2089,7 +2089,7 @@ int plugin_dispatch_values(value_list_t const *vl) { __attribute__((sentinel)) int plugin_dispatch_multivalue(value_list_t const *template, /* {{{ */ - _Bool store_percentage, int store_type, ...) { + bool store_percentage, int store_type, ...) { value_list_t *vl; int failed = 0; gauge_t sum = 0.0; @@ -2330,7 +2330,7 @@ static int plugin_notification_meta_add(notification_t *n, const char *name, break; } case NM_TYPE_BOOLEAN: { - meta->nm_value.nm_boolean = *((_Bool *)value); + meta->nm_value.nm_boolean = *((bool *)value); break; } default: { @@ -2375,7 +2375,7 @@ int plugin_notification_meta_add_double(notification_t *n, const char *name, } 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/daemon/plugin.h b/src/daemon/plugin.h index a9ee72d4..48a45cb1 100644 --- a/src/daemon/plugin.h +++ b/src/daemon/plugin.h @@ -147,7 +147,7 @@ typedef struct notification_meta_s { 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; @@ -230,7 +230,7 @@ void plugin_set_dir(const char *dir); * Re-loading an already loaded module is detected and zero is returned in * this case. */ -int plugin_load(const char *name, _Bool global); +int plugin_load(const char *name, bool global); int plugin_init_all(void); void plugin_read_all(void); @@ -374,7 +374,7 @@ int plugin_dispatch_values(value_list_t const *vl); * The number of values it failed to dispatch (zero on success). */ __attribute__((sentinel)) int plugin_dispatch_multivalue(value_list_t const *vl, - _Bool store_percentage, + bool store_percentage, int store_type, ...); int plugin_dispatch_missing(const value_list_t *vl); @@ -409,7 +409,7 @@ int plugin_notification_meta_add_unsigned_int(notification_t *n, int plugin_notification_meta_add_double(notification_t *n, const char *name, 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/daemon/plugin_mock.c b/src/daemon/plugin_mock.c index 96bf3826..f47b24be 100644 --- a/src/daemon/plugin_mock.c +++ b/src/daemon/plugin_mock.c @@ -39,7 +39,7 @@ char *hostname_g = "example.com"; void plugin_set_dir(const char *dir) { /* nop */ } -int plugin_load(const char *name, _Bool global) { return ENOTSUP; } +int plugin_load(const char *name, bool global) { return ENOTSUP; } int plugin_register_config(const char *name, int (*callback)(const char *key, const char *val), diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index b756d3b6..8e28a5d8 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -998,7 +998,7 @@ int uc_meta_data_exists(const value_list_t *vl, const value_list_t *vl, const char *key, double value) UC_WRAP(meta_data_add_double) int uc_meta_data_add_boolean( const value_list_t *vl, const char *key, - _Bool value) UC_WRAP(meta_data_add_boolean) + bool value) UC_WRAP(meta_data_add_boolean) int uc_meta_data_get_string(const value_list_t *vl, const char *key, @@ -1014,6 +1014,6 @@ int uc_meta_data_exists(const value_list_t *vl, const char *key, double *value) UC_WRAP(meta_data_get_double) int uc_meta_data_get_boolean( const value_list_t *vl, - const char *key, _Bool *value) + const char *key, bool *value) UC_WRAP(meta_data_get_boolean) #undef UC_WRAP diff --git a/src/daemon/utils_cache.h b/src/daemon/utils_cache.h index 08c2f10a..34ff7435 100644 --- a/src/daemon/utils_cache.h +++ b/src/daemon/utils_cache.h @@ -124,7 +124,7 @@ int uc_meta_data_add_unsigned_int(const value_list_t *vl, const char *key, int uc_meta_data_add_double(const value_list_t *vl, const char *key, double value); int uc_meta_data_add_boolean(const value_list_t *vl, const char *key, - _Bool value); + bool value); int uc_meta_data_get_string(const value_list_t *vl, const char *key, char **value); @@ -135,6 +135,6 @@ int uc_meta_data_get_unsigned_int(const value_list_t *vl, const char *key, int uc_meta_data_get_double(const value_list_t *vl, const char *key, double *value); int uc_meta_data_get_boolean(const value_list_t *vl, const char *key, - _Bool *value); + bool *value); #endif /* !UTILS_CACHE_H */ diff --git a/src/daemon/utils_complain.h b/src/daemon/utils_complain.h index 46d3a198..0ddb7bfd 100644 --- a/src/daemon/utils_complain.h +++ b/src/daemon/utils_complain.h @@ -39,7 +39,7 @@ typedef struct { * 0 indicates that the complaint is no longer valid. */ cdtime_t interval; - _Bool complained_once; + bool complained_once; } c_complain_t; #define C_COMPLAIN_INIT_STATIC \ diff --git a/src/daemon/utils_random.c b/src/daemon/utils_random.c index cf926f9c..def0ba68 100644 --- a/src/daemon/utils_random.c +++ b/src/daemon/utils_random.c @@ -32,7 +32,7 @@ #include static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; -static _Bool have_seed = 0; +static bool have_seed = 0; static unsigned short seed[3]; static void cdrand_seed(void) { diff --git a/src/daemon/utils_time.c b/src/daemon/utils_time.c index a807c7f9..5c0f68e7 100644 --- a/src/daemon/utils_time.c +++ b/src/daemon/utils_time.c @@ -144,7 +144,7 @@ static int format_zone(char *buffer, size_t buffer_size, } /* }}} int format_zone */ int format_rfc3339(char *buffer, size_t buffer_size, struct tm const *t_tm, - long nsec, _Bool print_nano, char const *zone) /* {{{ */ + long nsec, bool print_nano, char const *zone) /* {{{ */ { int len; char *pos = buffer; @@ -167,7 +167,7 @@ int format_rfc3339(char *buffer, size_t buffer_size, struct tm const *t_tm, } /* }}} int format_rfc3339 */ int format_rfc3339_utc(char *buffer, size_t buffer_size, cdtime_t t, - _Bool print_nano) /* {{{ */ + bool print_nano) /* {{{ */ { struct tm t_tm; long nsec = 0; @@ -181,7 +181,7 @@ int format_rfc3339_utc(char *buffer, size_t buffer_size, cdtime_t t, } /* }}} int format_rfc3339_utc */ int format_rfc3339_local(char *buffer, size_t buffer_size, cdtime_t t, - _Bool print_nano) /* {{{ */ + bool print_nano) /* {{{ */ { struct tm t_tm; long nsec = 0; diff --git a/src/dbi.c b/src/dbi.c index 60324e86..a61f66bc 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -54,7 +54,7 @@ struct cdbi_driver_option_s /* {{{ */ char *string; int numeric; } value; - _Bool is_numeric; + bool is_numeric; }; typedef struct cdbi_driver_option_s cdbi_driver_option_t; /* }}} */ diff --git a/src/df.c b/src/df.c index e1d5b513..5c08ca4a 100644 --- a/src/df.c +++ b/src/df.c @@ -55,10 +55,10 @@ static ignorelist_t *il_device = NULL; static ignorelist_t *il_mountpoint = NULL; static ignorelist_t *il_fstype = NULL; -static _Bool by_device = 0; -static _Bool report_inodes = 0; -static _Bool values_absolute = 1; -static _Bool values_percentage = 0; +static bool by_device = 0; +static bool report_inodes = 0; +static bool values_absolute = 1; +static bool values_percentage = 0; static int df_init(void) { if (il_device == NULL) diff --git a/src/disk.c b/src/disk.c index 116fc244..317e1054 100644 --- a/src/disk.c +++ b/src/disk.c @@ -82,7 +82,7 @@ static mach_port_t io_master_port = MACH_PORT_NULL; /* This defaults to false for backwards compatibility. Please fix in the next * major version. */ -static _Bool use_bsd_name = 0; +static bool use_bsd_name = 0; /* #endif HAVE_IOKIT_IOKITLIB_H */ #elif KERNEL_LINUX @@ -106,9 +106,9 @@ typedef struct diskstats { derive_t avg_read_time; derive_t avg_write_time; - _Bool has_merged; - _Bool has_in_progress; - _Bool has_io_time; + bool has_merged; + bool has_in_progress; + bool has_io_time; struct diskstats *next; } diskstats_t; diff --git a/src/dpdkevents.c b/src/dpdkevents.c index 064dce16..28156b0b 100644 --- a/src/dpdkevents.c +++ b/src/dpdkevents.c @@ -66,19 +66,19 @@ typedef struct dpdk_ka_monitor_s { typedef struct dpdk_link_status_config_s { int enabled; - _Bool send_updated; + bool send_updated; uint32_t enabled_port_mask; char port_name[RTE_MAX_ETHPORTS][DATA_MAX_NAME_LEN]; - _Bool notify; + bool notify; } dpdk_link_status_config_t; typedef struct dpdk_keep_alive_config_s { int enabled; - _Bool send_updated; + bool send_updated; uint128_t lcore_mask; dpdk_keepalive_shm_t *shm; char shm_name[DATA_MAX_NAME_LEN]; - _Bool notify; + bool notify; int fd; } dpdk_keep_alive_config_t; diff --git a/src/ethstat.c b/src/ethstat.c index c5b02d3e..c234d7e8 100644 --- a/src/ethstat.c +++ b/src/ethstat.c @@ -53,7 +53,7 @@ static size_t interfaces_num = 0; static c_avl_tree_t *value_map = NULL; -static _Bool collect_mapped_only = 0; +static bool collect_mapped_only = 0; static int ethstat_add_interface(const oconfig_item_t *ci) /* {{{ */ { diff --git a/src/fhcount.c b/src/fhcount.c index 97f0438c..1e84efa9 100644 --- a/src/fhcount.c +++ b/src/fhcount.c @@ -25,8 +25,8 @@ static const char *config_keys[] = {"ValuesAbsolute", "ValuesPercentage"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static _Bool values_absolute = 1; -static _Bool values_percentage = 0; +static bool values_absolute = 1; +static bool values_percentage = 0; static int fhcount_config(const char *key, const char *value) { int ret = -1; diff --git a/src/grpc.cc b/src/grpc.cc index 977c5b2c..fd2891f4 100644 --- a/src/grpc.cc +++ b/src/grpc.cc @@ -664,7 +664,7 @@ static int c_grpc_config_listen(oconfig_item_t *ci) { } pkcp.cert_chain = read_file(cert); } else if (!strcasecmp("VerifyPeer", child->key)) { - _Bool verify = 0; + bool verify = 0; if (cf_util_get_boolean(child, &verify)) { return -1; } diff --git a/src/hugepages.c b/src/hugepages.c index 29a7f9e0..95150460 100644 --- a/src/hugepages.c +++ b/src/hugepages.c @@ -35,12 +35,12 @@ static const char g_plugin_name[] = "hugepages"; -static _Bool g_flag_rpt_numa = 1; -static _Bool g_flag_rpt_mm = 1; +static bool g_flag_rpt_numa = 1; +static bool g_flag_rpt_mm = 1; -static _Bool g_values_pages = 1; -static _Bool g_values_bytes = 0; -static _Bool g_values_percent = 0; +static bool g_values_pages = 1; +static bool g_values_bytes = 0; +static bool g_values_percent = 0; #define HP_HAVE_NR 0x01 #define HP_HAVE_SURPLUS 0x02 diff --git a/src/intel_pmu.c b/src/intel_pmu.c index d868c892..23536841 100644 --- a/src/intel_pmu.c +++ b/src/intel_pmu.c @@ -64,9 +64,9 @@ struct event_info { typedef struct event_info event_info_t; struct intel_pmu_ctx_s { - _Bool hw_cache_events; - _Bool kernel_pmu_events; - _Bool sw_events; + bool hw_cache_events; + bool kernel_pmu_events; + bool sw_events; char event_list_fn[PATH_MAX]; char **hw_events; size_t hw_events_count; diff --git a/src/interface.c b/src/interface.c index c45ef660..64764d51 100644 --- a/src/interface.c +++ b/src/interface.c @@ -88,7 +88,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); static ignorelist_t *ignorelist = NULL; -static _Bool report_inactive = 1; +static bool report_inactive = 1; #ifdef HAVE_LIBKSTAT #if HAVE_KSTAT_H @@ -98,7 +98,7 @@ static _Bool report_inactive = 1; extern kstat_ctl_t *kc; static kstat_t *ksp[MAX_NUMIF]; static int numif = 0; -static _Bool unique_name = 0; +static bool unique_name = 0; #endif /* HAVE_LIBKSTAT */ static int interface_config(const char *key, const char *value) { diff --git a/src/ipmi.c b/src/ipmi.c index 6a72b2b7..64651a24 100644 --- a/src/ipmi.c +++ b/src/ipmi.c @@ -49,12 +49,12 @@ typedef struct c_ipmi_sensor_list_s c_ipmi_sensor_list_t; struct c_ipmi_instance_s { char *name; ignorelist_t *ignorelist; - _Bool notify_add; - _Bool notify_remove; - _Bool notify_notpresent; - _Bool notify_conn; - _Bool sel_enabled; - _Bool sel_clear_event; + bool notify_add; + bool notify_remove; + bool notify_notpresent; + bool notify_conn; + bool sel_enabled; + bool sel_clear_event; char *host; char *connaddr; @@ -62,12 +62,12 @@ struct c_ipmi_instance_s { char *password; unsigned int authtype; - _Bool connected; + bool connected; ipmi_con_t *connection; pthread_mutex_t sensor_list_lock; c_ipmi_sensor_list_t *sensor_list; - _Bool active; + bool active; pthread_t thread_id; int init_in_progress; @@ -1065,7 +1065,7 @@ static int c_ipmi_config_add_instance(oconfig_item_t *ci) { if (strcasecmp("Sensor", child->key) == 0) ignorelist_add(st->ignorelist, child->values[0].value.string); else if (strcasecmp("IgnoreSelected", child->key) == 0) { - _Bool t; + bool t; status = cf_util_get_boolean(child, &t); if (status != 0) break; @@ -1124,7 +1124,7 @@ static int c_ipmi_config_add_instance(oconfig_item_t *ci) { } /* int c_ipmi_config_add_instance */ static int c_ipmi_config(oconfig_item_t *ci) { - _Bool have_instance_block = 0; + bool have_instance_block = 0; for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; diff --git a/src/libcollectdclient/network_buffer.c b/src/libcollectdclient/network_buffer.c index a0f8cfdc..755d476c 100644 --- a/src/libcollectdclient/network_buffer.c +++ b/src/libcollectdclient/network_buffer.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -122,10 +123,10 @@ struct lcc_network_buffer_s { /* * Private functions */ -static _Bool have_gcrypt(void) /* {{{ */ +static bool have_gcrypt(void) /* {{{ */ { - static _Bool result = 0; - static _Bool need_init = 1; + static bool result = 0; + static bool need_init = 1; if (!need_init) return result; @@ -150,7 +151,7 @@ static _Bool have_gcrypt(void) /* {{{ */ #else return 0; #endif -} /* }}} _Bool have_gcrypt */ +} /* }}} bool have_gcrypt */ #ifndef HAVE_HTONLL static uint64_t htonll(uint64_t val) /* {{{ */ diff --git a/src/libcollectdclient/network_parse.c b/src/libcollectdclient/network_parse.c index 14c1b282..91fe18de 100644 --- a/src/libcollectdclient/network_parse.c +++ b/src/libcollectdclient/network_parse.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include diff --git a/src/libcollectdclient/server.c b/src/libcollectdclient/server.c index 0e6d7779..1733b61a 100644 --- a/src/libcollectdclient/server.c +++ b/src/libcollectdclient/server.c @@ -34,6 +34,7 @@ #include "collectd/server.h" #include +#include #include #include #include @@ -45,7 +46,7 @@ #include #define DEBUG(...) printf(__VA_ARGS__) -static _Bool is_multicast(struct addrinfo const *ai) { +static bool is_multicast(struct addrinfo const *ai) { if (ai->ai_family == AF_INET) { struct sockaddr_in *addr = (struct sockaddr_in *)ai->ai_addr; return IN_MULTICAST(ntohl(addr->sin_addr.s_addr)); @@ -175,7 +176,7 @@ static int server_open(lcc_listener_t *srv) { } int lcc_listen_and_write(lcc_listener_t srv) { - _Bool close_socket = 0; + bool close_socket = 0; if (srv.conn < 0) { int status = server_open(&srv); diff --git a/src/load.c b/src/load.c index 83aca5ee..ac07fa64 100644 --- a/src/load.c +++ b/src/load.c @@ -55,7 +55,7 @@ #include #endif /* HAVE_PERFSTAT */ -static _Bool report_relative_load = 0; +static bool report_relative_load = 0; static const char *config_keys[] = {"ReportRelative"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); diff --git a/src/log_logstash.c b/src/log_logstash.c index de34b0ea..134df6e0 100644 --- a/src/log_logstash.c +++ b/src/log_logstash.c @@ -75,7 +75,7 @@ static int log_logstash_config(const char *key, const char *value) { static void log_logstash_print(yajl_gen g, int severity, cdtime_t timestamp_time) { FILE *fh; - _Bool do_close = 0; + bool do_close = 0; struct tm timestamp_tm; char timestamp_str[64]; const unsigned char *buf; diff --git a/src/logfile.c b/src/logfile.c index 66922870..3917aa8f 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -77,7 +77,7 @@ static int logfile_config(const char *key, const char *value) { static void logfile_print(const char *msg, int severity, cdtime_t timestamp_time) { FILE *fh; - _Bool do_close = 0; + bool do_close = 0; char timestamp_str[64]; char level_str[16] = ""; diff --git a/src/lpar.c b/src/lpar.c index c4189b7d..367ebcdc 100644 --- a/src/lpar.c +++ b/src/lpar.c @@ -40,10 +40,10 @@ static const char *config_keys[] = {"CpuPoolStats", "ReportBySerial"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static _Bool pool_stats = 0; -static _Bool report_by_serial = 0; +static bool pool_stats = 0; +static bool report_by_serial = 0; #if PERFSTAT_SUPPORTS_DONATION -static _Bool donate_flag = 0; +static bool donate_flag = 0; #endif static char serial[SYS_NMLN]; diff --git a/src/match_regex.c b/src/match_regex.c index dd4018b0..84934a6c 100644 --- a/src/match_regex.c +++ b/src/match_regex.c @@ -66,7 +66,7 @@ struct mr_match_s { mr_regex_t *type; mr_regex_t *type_instance; llist_t *meta; /* Maps each meta key into mr_regex_t* */ - _Bool invert; + bool invert; }; /* diff --git a/src/mcelog.c b/src/mcelog.c index 1a92a065..5692a000 100644 --- a/src/mcelog.c +++ b/src/mcelog.c @@ -56,7 +56,7 @@ typedef struct mcelog_config_s { pthread_t tid; /* poll thread id */ llist_t *dimms_list; /* DIMMs list */ pthread_mutex_t dimms_lock; /* lock for dimms cache */ - _Bool persist; + bool persist; } mcelog_config_t; typedef struct socket_adapter_s socket_adapter_t; @@ -106,8 +106,8 @@ static socket_adapter_t socket_adapter = { .receive = socket_receive, }; -static _Bool mcelog_thread_running; -static _Bool mcelog_apply_defaults; +static bool mcelog_thread_running; +static bool mcelog_apply_defaults; static void mcelog_free_dimms_list_records(llist_t *dimms_list) { diff --git a/src/memcached.c b/src/memcached.c index 635088eb..95a9edad 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -69,7 +69,7 @@ struct memcached_s { }; typedef struct memcached_s memcached_t; -static _Bool memcached_have_instances = 0; +static bool memcached_have_instances = 0; static void memcached_free(void *arg) { memcached_t *st = arg; @@ -755,7 +755,7 @@ static int config_add_instance(oconfig_item_t *ci) { } /* int config_add_instance */ static int memcached_config(oconfig_item_t *ci) { - _Bool have_instance_block = 0; + bool have_instance_block = 0; for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; diff --git a/src/memory.c b/src/memory.c index 80b11049..336a6307 100644 --- a/src/memory.c +++ b/src/memory.c @@ -94,8 +94,8 @@ static int pagesize; #error "No applicable input method." #endif -static _Bool values_absolute = 1; -static _Bool values_percentage = 0; +static bool values_absolute = 1; +static bool values_percentage = 0; static int memory_config(oconfig_item_t *ci) /* {{{ */ { @@ -268,7 +268,7 @@ static int memory_read_internal(value_list_t *vl) { char *fields[8]; int numfields; - _Bool detailed_slab_info = 0; + bool detailed_slab_info = 0; gauge_t mem_total = 0; gauge_t mem_used = 0; diff --git a/src/mic.c b/src/mic.c index 3f9521d8..55bc684d 100644 --- a/src/mic.c +++ b/src/mic.c @@ -50,12 +50,12 @@ static const char *config_keys[] = { "ShowPower", "Power", "IgnoreSelectedPower"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static _Bool show_cpu = 1; -static _Bool show_cpu_cores = 1; -static _Bool show_memory = 1; -static _Bool show_temps = 1; +static bool show_cpu = 1; +static bool show_cpu_cores = 1; +static bool show_memory = 1; +static bool show_temps = 1; static ignorelist_t *temp_ignore = NULL; -static _Bool show_power = 1; +static bool show_power = 1; static ignorelist_t *power_ignore = NULL; static int mic_init(void) { diff --git a/src/modbus.c b/src/modbus.c index daa3c028..2f1a6820 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -135,7 +135,7 @@ struct mb_host_s /* {{{ */ #else modbus_t *connection; #endif - _Bool is_connected; + bool is_connected; }; /* }}} */ typedef struct mb_host_s mb_host_t; diff --git a/src/mqtt.c b/src/mqtt.c index d134c381..097302ad 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -54,11 +54,11 @@ * Data types */ struct mqtt_client_conf { - _Bool publish; + bool publish; char *name; struct mosquitto *mosq; - _Bool connected; + bool connected; char *host; int port; @@ -74,14 +74,14 @@ struct mqtt_client_conf { /* For publishing */ char *topic_prefix; - _Bool store_rates; - _Bool retain; + bool store_rates; + bool retain; /* For subscribing */ pthread_t thread; - _Bool loop; + bool loop; char *topic; - _Bool clean_session; + bool clean_session; c_complain_t complaint_cantpublish; pthread_mutex_t lock; diff --git a/src/mysql.c b/src/mysql.c index 448f7cba..1396e954 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -58,17 +58,17 @@ struct mysql_database_s /* {{{ */ int port; int timeout; - _Bool master_stats; - _Bool slave_stats; - _Bool innodb_stats; - _Bool wsrep_stats; + bool master_stats; + bool slave_stats; + bool innodb_stats; + bool wsrep_stats; - _Bool slave_notif; - _Bool slave_io_running; - _Bool slave_sql_running; + bool slave_notif; + bool slave_io_running; + bool slave_sql_running; MYSQL *con; - _Bool is_connected; + bool is_connected; }; typedef struct mysql_database_s mysql_database_t; /* }}} */ diff --git a/src/netapp.c b/src/netapp.c index 44fb9768..90b3791c 100644 --- a/src/netapp.c +++ b/src/netapp.c @@ -2842,7 +2842,7 @@ static int cna_register_host(host_config_t *host) /* {{{ */ static int cna_config_host(host_config_t *host, /* {{{ */ const oconfig_item_t *ci) { oconfig_item_t *item; - _Bool is_vfiler = 0; + bool is_vfiler = 0; int status; if (!strcasecmp(ci->key, "VFiler")) diff --git a/src/netlink.c b/src/netlink.c index 051458f6..a9d324a3 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -449,7 +449,7 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) { const char *tc_type; char tc_inst[DATA_MAX_NAME_LEN]; - _Bool stats_submitted = 0; + bool stats_submitted = 0; if (nlh->nlmsg_type == RTM_NEWQDISC) tc_type = "qdisc"; diff --git a/src/network.c b/src/network.c index fcacd38a..3b5a0f2d 100644 --- a/src/network.c +++ b/src/network.c @@ -264,8 +264,8 @@ typedef struct receive_list_entry_s receive_list_entry_t; static int network_config_ttl = 0; /* Ethernet - (IPv6 + UDP) = 1500 - (40 + 8) = 1452 */ static size_t network_config_packet_size = 1452; -static _Bool network_config_forward = 0; -static _Bool network_config_stats = 0; +static bool network_config_forward = 0; +static bool network_config_stats = 0; static sockent_t *sending_sockets = NULL; @@ -314,7 +314,7 @@ static pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER; /* * Private functions */ -static _Bool check_receive_okay(const value_list_t *vl) /* {{{ */ +static bool check_receive_okay(const value_list_t *vl) /* {{{ */ { uint64_t time_sent = 0; int status; @@ -327,11 +327,11 @@ static _Bool check_receive_okay(const value_list_t *vl) /* {{{ */ return 0; return 1; -} /* }}} _Bool check_receive_okay */ +} /* }}} bool check_receive_okay */ -static _Bool check_send_okay(const value_list_t *vl) /* {{{ */ +static bool check_send_okay(const value_list_t *vl) /* {{{ */ { - _Bool received = 0; + bool received = 0; int status; if (network_config_forward) @@ -353,22 +353,22 @@ static _Bool check_send_okay(const value_list_t *vl) /* {{{ */ /* By default, only *send* value lists that were not *received* by the * network plugin. */ return !received; -} /* }}} _Bool check_send_okay */ +} /* }}} bool check_send_okay */ -static _Bool check_notify_received(const notification_t *n) /* {{{ */ +static bool check_notify_received(const notification_t *n) /* {{{ */ { for (notification_meta_t *ptr = n->meta; ptr != NULL; ptr = ptr->next) if ((strcmp("network:received", ptr->name) == 0) && (ptr->type == NM_TYPE_BOOLEAN)) - return (_Bool)ptr->nm_value.nm_boolean; + return (bool)ptr->nm_value.nm_boolean; return 0; -} /* }}} _Bool check_notify_received */ +} /* }}} bool check_notify_received */ -static _Bool check_send_notify_okay(const notification_t *n) /* {{{ */ +static bool check_send_notify_okay(const notification_t *n) /* {{{ */ { static c_complain_t complain_forwarding = C_COMPLAIN_INIT_STATIC; - _Bool received = 0; + bool received = 0; if (n->meta == NULL) return 1; @@ -388,7 +388,7 @@ static _Bool check_send_notify_okay(const notification_t *n) /* {{{ */ /* By default, only *send* value lists that were not *received* by the * network plugin. */ return !received; -} /* }}} _Bool check_send_notify_okay */ +} /* }}} bool check_send_notify_okay */ static int network_dispatch_values(value_list_t *vl, /* {{{ */ const char *username) { @@ -1924,7 +1924,7 @@ static int sockent_client_connect(sockent_t *se) /* {{{ */ struct sockent_client *client; struct addrinfo *ai_list; int status; - _Bool reconnect = 0; + bool reconnect = 0; cdtime_t now; if ((se == NULL) || (se->type != SOCKENT_TYPE_CLIENT)) @@ -3096,7 +3096,7 @@ static int network_stats_read(void) /* {{{ */ } /* }}} int network_stats_read */ static int network_init(void) { - static _Bool have_init = 0; + 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). */ diff --git a/src/nfs.c b/src/nfs.c index f50a3524..8d5b6309 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -33,9 +33,9 @@ static const char *config_keys[] = {"ReportV2", "ReportV3", "ReportV4"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static _Bool report_v2 = 1; -static _Bool report_v3 = 1; -static _Bool report_v4 = 1; +static bool report_v2 = 1; +static bool report_v3 = 1; +static bool report_v4 = 1; /* see /proc/net/rpc/nfs diff --git a/src/ntpd.c b/src/ntpd.c index ed3c0422..ffb71b03 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -56,12 +56,12 @@ static const char *config_keys[] = {"Host", "Port", "ReverseLookups", "IncludeUnitID"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static _Bool do_reverse_lookups = 1; +static bool do_reverse_lookups = 1; /* This option only exists for backward compatibility. If it is false and two * ntpd peers use the same refclock driver, the plugin will try to write * simultaneous measurements from both to the same type instance. */ -static _Bool include_unit_id = 0; +static bool include_unit_id = 0; #define NTPD_DEFAULT_HOST "localhost" #define NTPD_DEFAULT_PORT "123" @@ -717,7 +717,7 @@ ntpd_get_refclock_id(struct info_peer_summary const *peer_info) { static int ntpd_get_name_from_address(char *buffer, size_t buffer_size, struct info_peer_summary const *peer_info, - _Bool do_reverse_lookup) { + bool do_reverse_lookup) { struct sockaddr_storage sa = {0}; socklen_t sa_len; int flags = 0; diff --git a/src/onewire.c b/src/onewire.c index c2037518..65c071b5 100644 --- a/src/onewire.c +++ b/src/onewire.c @@ -88,7 +88,7 @@ static int ow_family_features_num = STATIC_ARRAY_SIZE(ow_family_features); static char *device_g = NULL; static cdtime_t ow_interval = 0; -static _Bool direct_access = 0; +static bool direct_access = 0; static const char *config_keys[] = {"Device", "IgnoreSelected", "Sensor", "Interval"}; @@ -96,7 +96,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); static ignorelist_t *sensor_list; -static _Bool regex_direct_initialized = 0; +static bool regex_direct_initialized = 0; static regex_t regex_direct; /** diff --git a/src/openldap.c b/src/openldap.c index afe2479e..c601d9ca 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -47,10 +47,10 @@ struct cldap_s /* {{{ */ char *password; char *cacert; char *host; - _Bool starttls; + bool starttls; int timeout; char *url; - _Bool verifyhost; + bool verifyhost; int version; LDAP *ld; diff --git a/src/openvpn.c b/src/openvpn.c index 608bef60..4c3e464d 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -80,10 +80,10 @@ struct vpn_status_s { }; typedef struct vpn_status_s vpn_status_t; -static _Bool new_naming_schema = 0; -static _Bool collect_compression = 1; -static _Bool collect_user_count = 0; -static _Bool collect_individual_users = 1; +static bool new_naming_schema = 0; +static bool collect_compression = 1; +static bool collect_user_count = 0; +static bool collect_individual_users = 1; static const char *config_keys[] = { "StatusFile", "Compression", /* old, deprecated name */ @@ -247,7 +247,7 @@ static int multi1_read(const char *name, FILE *fh) { char *fields[10]; const int max_fields = STATIC_ARRAY_SIZE(fields); long long sum_users = 0; - _Bool found_header = 0; + bool found_header = 0; /* read the file until the "ROUTING TABLE" line is found (no more info after) */ @@ -320,7 +320,7 @@ static int multi2_read(const char *name, FILE *fh) { const int max_fields = STATIC_ARRAY_SIZE(fields); long long sum_users = 0; - _Bool found_header = 0; + bool found_header = 0; int idx_cname = 0; int idx_bytes_recv = 0; int idx_bytes_sent = 0; diff --git a/src/ovs_events.c b/src/ovs_events.c index ef59b4c2..a302f115 100644 --- a/src/ovs_events.c +++ b/src/ovs_events.c @@ -66,7 +66,7 @@ typedef struct ovs_events_iface_list_s ovs_events_iface_list_t; /* OVS events configuration data */ struct ovs_events_config_s { - _Bool send_notification; /* sent notification to collectd? */ + bool send_notification; /* sent notification to collectd? */ char ovs_db_node[OVS_DB_ADDR_NODE_SIZE]; /* OVS DB node */ char ovs_db_serv[OVS_DB_ADDR_SERVICE_SIZE]; /* OVS DB service */ char ovs_db_unix[OVS_DB_ADDR_UNIX_SIZE]; /* OVS DB unix socket path */ @@ -80,7 +80,7 @@ struct ovs_events_ctx_s { ovs_db_t *ovs_db; /* pointer to OVS DB instance */ ovs_events_config_t config; /* plugin config */ char *ovs_db_select_params; /* OVS DB select parameter request */ - _Bool is_db_available; /* specify whether OVS DB is available */ + bool is_db_available; /* specify whether OVS DB is available */ }; typedef struct ovs_events_ctx_s ovs_events_ctx_t; @@ -231,7 +231,7 @@ static int ovs_events_config_get_interfaces(const oconfig_item_t *ci) { * in allocated memory. Returns negative value in case of error. */ static int ovs_events_plugin_config(oconfig_item_t *ci) { - _Bool dispatch_values = 0; + bool dispatch_values = 0; for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; if (strcasecmp("SendNotification", child->key) == 0) { @@ -592,7 +592,7 @@ static void ovs_events_conn_terminate() { /* Read OVS DB interface link status callback */ static int ovs_events_plugin_read(__attribute__((unused)) user_data_t *u) { - _Bool is_connected = 0; + bool is_connected = 0; OVS_EVENTS_CTX_LOCK { is_connected = ovs_events_ctx.is_db_available; } if (is_connected) if (ovs_db_send_request(ovs_events_ctx.ovs_db, "transact", diff --git a/src/perl.c b/src/perl.c index 5ad99ee4..cdacbb77 100644 --- a/src/perl.c +++ b/src/perl.c @@ -138,8 +138,8 @@ static int perl_flush(cdtime_t timeout, const char *identifier, typedef struct c_ithread_s { /* the thread's Perl interpreter */ PerlInterpreter *interp; - _Bool running; /* thread is inside Perl interpreter */ - _Bool shutdown; + bool running; /* thread is inside Perl interpreter */ + bool shutdown; pthread_t pthread; /* double linked list of threads */ @@ -183,7 +183,7 @@ extern char **environ; * private variables */ -static _Bool register_legacy_flush = 1; +static bool register_legacy_flush = 1; /* if perl_threads != NULL perl_threads->head must * point to the "base" thread */ @@ -981,7 +981,7 @@ static int pplugin_dispatch_notification(pTHX_ HV *notif) { * Call perl sub with thread locking flags handled. */ static int call_pv_locked(pTHX_ const char *sub_name) { - _Bool old_running; + bool old_running; int ret; c_ithread_t *t = (c_ithread_t *)pthread_getspecific(perl_thr_key); diff --git a/src/pf.c b/src/pf.c index 1e4c465b..aa2a53a4 100644 --- a/src/pf.c +++ b/src/pf.c @@ -58,7 +58,7 @@ static char const *pf_scounters[SCNT_MAX + 1] = SCNT_NAMES; static char const *pf_device = "/dev/pf"; static void pf_submit(char const *type, char const *type_instance, uint64_t val, - _Bool is_gauge) { + bool is_gauge) { value_t values[1]; value_list_t vl = VALUE_LIST_INIT; diff --git a/src/pinba.c b/src/pinba.c index 339988df..02bdcc2b 100644 --- a/src/pinba.c +++ b/src/pinba.c @@ -106,8 +106,8 @@ static pthread_mutex_t stat_nodes_lock; static char *conf_node = NULL; static char *conf_service = NULL; -static _Bool collector_thread_running = 0; -static _Bool collector_thread_do_shutdown = 0; +static bool collector_thread_running = 0; +static bool collector_thread_do_shutdown = 0; static pthread_t collector_thread_id; /* }}} */ diff --git a/src/ping.c b/src/ping.c index b619e37a..89e407b2 100644 --- a/src/ping.c +++ b/src/ping.c @@ -298,7 +298,7 @@ static void *ping_thread(void *arg) /* {{{ */ pthread_mutex_lock(&ping_lock); while (ping_thread_loop > 0) { - _Bool send_successful = 0; + bool send_successful = 0; if (gettimeofday(&tv_begin, NULL) < 0) { ERROR("ping plugin: gettimeofday failed: %s", STRERRNO); diff --git a/src/postgresql.c b/src/postgresql.c index 62b3d553..7316c547 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -102,7 +102,7 @@ typedef struct { typedef struct { char *name; char *statement; - _Bool store_rates; + bool store_rates; } c_psql_writer_t; typedef struct { @@ -348,7 +348,7 @@ static int c_psql_connect(c_psql_database_t *db) { } /* c_psql_connect */ static int c_psql_check_connection(c_psql_database_t *db) { - _Bool init = 0; + bool init = 0; if (!db->conn) { init = 1; @@ -664,7 +664,7 @@ static char *values_name_to_sqlarray(const data_set_t *ds, char *string, } /* values_name_to_sqlarray */ static char *values_type_to_sqlarray(const data_set_t *ds, char *string, - size_t string_len, _Bool store_rates) { + size_t string_len, bool store_rates) { char *str_ptr; size_t str_len; @@ -707,7 +707,7 @@ static char *values_type_to_sqlarray(const data_set_t *ds, char *string, static char *values_to_sqlarray(const data_set_t *ds, const value_list_t *vl, char *string, size_t string_len, - _Bool store_rates) { + bool store_rates) { char *str_ptr; size_t str_len; @@ -936,7 +936,7 @@ static int c_psql_flush(cdtime_t timeout, } /* c_psql_flush */ static int c_psql_shutdown(void) { - _Bool had_flush = 0; + bool had_flush = 0; plugin_unregister_read_group("postgresql"); @@ -1124,7 +1124,7 @@ static int c_psql_config_database(oconfig_item_t *ci) { c_psql_database_t *db; char cb_name[DATA_MAX_NAME_LEN]; - static _Bool have_flush = 0; + static bool have_flush = 0; if ((1 != ci->values_num) || (OCONFIG_TYPE_STRING != ci->values[0].type)) { log_err(" expects a single string argument."); diff --git a/src/processes.c b/src/processes.c index d73d24a2..8e11175a 100644 --- a/src/processes.c +++ b/src/processes.c @@ -198,20 +198,20 @@ typedef struct process_entry_s { derive_t io_syscw; derive_t io_diskr; derive_t io_diskw; - _Bool has_io; + bool has_io; derive_t cswitch_vol; derive_t cswitch_invol; - _Bool has_cswitch; + bool has_cswitch; #if HAVE_LIBTASKSTATS ts_delay_t delay; #endif - _Bool has_delay; + bool has_delay; - _Bool has_fd; + bool has_fd; - _Bool has_maps; + bool has_maps; } process_entry_t; typedef struct procstat_entry_s { @@ -284,10 +284,10 @@ typedef struct procstat { gauge_t delay_swapin; gauge_t delay_freepages; - _Bool report_fd_num; - _Bool report_maps_num; - _Bool report_ctx_switch; - _Bool report_delay; + bool report_fd_num; + bool report_maps_num; + bool report_ctx_switch; + bool report_delay; struct procstat *next; struct procstat_entry_s *instances; @@ -295,11 +295,11 @@ typedef struct procstat { static procstat_t *list_head_g = NULL; -static _Bool want_init = 1; -static _Bool report_ctx_switch = 0; -static _Bool report_fd_num = 0; -static _Bool report_maps_num = 0; -static _Bool report_delay = 0; +static bool want_init = 1; +static bool report_ctx_switch = 0; +static bool report_fd_num = 0; +static bool report_maps_num = 0; +static bool report_delay = 0; #if HAVE_THREAD_INFO static mach_port_t port_host_self; @@ -1521,7 +1521,7 @@ static int read_fork_rate(void) { FILE *proc_stat; char buffer[1024]; value_t value; - _Bool value_valid = 0; + bool value_valid = 0; proc_stat = fopen("/proc/stat", "r"); if (proc_stat == NULL) { @@ -2137,7 +2137,7 @@ static int ps_read(void) { * filter out threads (duplicate PID entries). */ if ((proc_ptr == NULL) || (proc_ptr->ki_pid != procs[i].ki_pid)) { char cmdline[CMDLINE_BUFFER_SIZE] = ""; - _Bool have_cmdline = 0; + bool have_cmdline = 0; proc_ptr = &(procs[i]); /* Don't probe system processes and processes without arguments */ @@ -2292,7 +2292,7 @@ static int ps_read(void) { * filter out threads (duplicate PID entries). */ if ((proc_ptr == NULL) || (proc_ptr->p_pid != procs[i].p_pid)) { char cmdline[CMDLINE_BUFFER_SIZE] = ""; - _Bool have_cmdline = 0; + bool have_cmdline = 0; proc_ptr = &(procs[i]); /* Don't probe zombie processes */ diff --git a/src/python.c b/src/python.c index e60ba459..178f52d2 100644 --- a/src/python.c +++ b/src/python.c @@ -241,7 +241,7 @@ static char CollectdError_doc[] = static pthread_t main_thread; static PyOS_sighandler_t python_sigint_handler; -static _Bool do_interactive = 0; +static bool do_interactive = 0; /* This is our global thread state. Python saves some stuff in thread-local * storage. So if we allow the interpreter to run in the background @@ -448,7 +448,7 @@ static int cpy_write_callback(const data_set_t *ds, int64_t si; uint64_t ui; double d; - _Bool b; + bool b; type = meta_data_type(meta, table[i]); if (type == MD_TYPE_STRING) { @@ -1366,7 +1366,7 @@ static int cpy_config(oconfig_item_t *ci) { #endif sfree(encoding); } else if (strcasecmp(item->key, "LogTraces") == 0) { - _Bool log_traces; + bool log_traces; if (cf_util_get_boolean(item, &log_traces) != 0) { status = 1; continue; diff --git a/src/pyvalues.c b/src/pyvalues.c index 7fe0a315..1aaa3f0a 100644 --- a/src/pyvalues.c +++ b/src/pyvalues.c @@ -38,7 +38,7 @@ typedef struct { int (*add_signed_int)(void *, const char *, int64_t); int (*add_unsigned_int)(void *, const char *, uint64_t); int (*add_double)(void *, const char *, double); - int (*add_boolean)(void *, const char *, _Bool); + int (*add_boolean)(void *, const char *, bool); } cpy_build_meta_handler_t; #define FreeAll() \ @@ -562,7 +562,7 @@ static int cpy_build_meta_generic(PyObject *meta, CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_signed_int, int64_t) \ CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_unsigned_int, uint64_t) \ CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_double, double) \ - CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_boolean, _Bool) \ + CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_boolean, bool) \ \ static cpy_build_meta_handler_t cpy_##func_prefix = { \ .add_string = cpy_##func_prefix##_add_string, \ diff --git a/src/routeros.c b/src/routeros.c index c502c3da..c0d5ef7f 100644 --- a/src/routeros.c +++ b/src/routeros.c @@ -39,12 +39,12 @@ struct cr_data_s { char *username; char *password; - _Bool collect_interface; - _Bool collect_regtable; - _Bool collect_cpu_load; - _Bool collect_memory; - _Bool collect_df; - _Bool collect_disk; + bool collect_interface; + bool collect_regtable; + bool collect_cpu_load; + bool collect_memory; + bool collect_df; + bool collect_disk; }; typedef struct cr_data_s cr_data_t; diff --git a/src/rrdcached.c b/src/rrdcached.c index 529d29c1..f9c2af39 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -39,8 +39,8 @@ */ static char *datadir = NULL; static char *daemon_address = NULL; -static _Bool config_create_files = 1; -static _Bool config_collect_stats = 1; +static bool config_create_files = 1; +static bool config_collect_stats = 1; static rrdcreate_config_t rrdcreate_config = { /* stepsize = */ 0, /* heartbeat = */ 0, @@ -284,7 +284,7 @@ static int try_reconnect(void) { static int rc_read(void) { int status; rrdc_stats_t *head; - _Bool retried = 0; + bool retried = 0; value_list_t vl = VALUE_LIST_INIT; vl.values = &(value_t){.gauge = NAN}; @@ -392,7 +392,7 @@ static int rc_write(const data_set_t *ds, const value_list_t *vl, char values[512]; char *values_array[2]; int status; - _Bool retried = 0; + bool retried = 0; if (daemon_address == NULL) { ERROR("rrdcached plugin: daemon_address == NULL."); @@ -474,7 +474,7 @@ static int rc_flush(__attribute__((unused)) cdtime_t timeout, /* {{{ */ __attribute__((unused)) user_data_t *ud) { char filename[PATH_MAX + 1]; int status; - _Bool retried = 0; + bool retried = 0; if (identifier == NULL) return EINVAL; diff --git a/src/sensors.c b/src/sensors.c index 572d41f1..4d8e9256 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -158,7 +158,7 @@ typedef struct featurelist { } featurelist_t; static char *conffile = NULL; -static _Bool use_labels = 0; +static bool use_labels = 0; /* #endif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */ #else /* if SENSORS_API_VERSION >= 0x500 */ diff --git a/src/serial.c b/src/serial.c index 2b77db65..1b587ca3 100644 --- a/src/serial.c +++ b/src/serial.c @@ -59,7 +59,7 @@ static int serial_read(void) { while (fgets(buffer, sizeof(buffer), fh) != NULL) { derive_t rx = 0; derive_t tx = 0; - _Bool have_rx = 0, have_tx = 0; + bool have_rx = 0, have_tx = 0; size_t len; char *fields[16]; diff --git a/src/snmp.c b/src/snmp.c index d0f9e846..923a5c4f 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -53,7 +53,7 @@ typedef union instance_u instance_t; struct data_definition_s { char *name; /* used to reference this from the `Collect' option */ char *type; /* used to find the data_set */ - _Bool is_table; + bool is_table; instance_t instance; char *instance_prefix; oid_t *values; @@ -63,7 +63,7 @@ struct data_definition_s { struct data_definition_s *next; char **ignores; size_t ignores_len; - _Bool invert_match; + bool invert_match; }; typedef struct data_definition_s data_definition_t; @@ -830,9 +830,9 @@ static value_t csnmp_value_list_to_value(struct variable_list *vl, int type, value_t ret; uint64_t tmp_unsigned = 0; int64_t tmp_signed = 0; - _Bool defined = 1; + bool defined = 1; /* Set to true when the original SNMP type appears to have been signed. */ - _Bool prefer_signed = 0; + bool prefer_signed = 0; if ((vl->type == ASN_INTEGER) || (vl->type == ASN_UINTEGER) || (vl->type == ASN_COUNTER) @@ -1065,7 +1065,7 @@ static int csnmp_instance_list_add(csnmp_list_instances_t **head, char *ptr; csnmp_strvbcopy(il->instance, vb, sizeof(il->instance)); - _Bool is_matched = 0; + bool is_matched = 0; for (uint32_t i = 0; i < dd->ignores_len; i++) { status = fnmatch(dd->ignores[i], il->instance, 0); if (status == 0) { @@ -1119,7 +1119,7 @@ static int csnmp_dispatch_table(host_definition_t *host, csnmp_table_values_t *value_table_ptr[data->values_len]; size_t i; - _Bool have_more; + bool have_more; oid_t current_suffix; ds = plugin_get_ds(data->type); @@ -1142,7 +1142,7 @@ static int csnmp_dispatch_table(host_definition_t *host, have_more = 1; while (have_more) { - _Bool suffix_skipped = 0; + bool suffix_skipped = 0; /* Determine next suffix to handle. */ if (instance_list != NULL) { @@ -1268,7 +1268,7 @@ static int csnmp_read_table(host_definition_t *host, data_definition_t *data) { oid_t oid_list[oid_list_len]; /* Set to false when an OID has left its subtree so we don't re-request it * again. */ - _Bool oid_list_todo[oid_list_len]; + bool oid_list_todo[oid_list_len]; int status; size_t i; diff --git a/src/snmp_agent.c b/src/snmp_agent.c index b213adb1..0675a767 100644 --- a/src/snmp_agent.c +++ b/src/snmp_agent.c @@ -71,7 +71,7 @@ struct data_definition_s { char *type; char *type_instance; const table_definition_t *table; - _Bool is_instance; + bool is_instance; oid_t *oids; size_t oids_len; double scale; diff --git a/src/statsd.c b/src/statsd.c index ccd15ebe..34ce5863 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -65,25 +65,25 @@ static c_avl_tree_t *metrics_tree = NULL; static pthread_mutex_t metrics_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_t network_thread; -static _Bool network_thread_running = 0; -static _Bool network_thread_shutdown = 0; +static bool network_thread_running = 0; +static bool network_thread_shutdown = 0; static char *conf_node = NULL; static char *conf_service = NULL; -static _Bool conf_delete_counters = 0; -static _Bool conf_delete_timers = 0; -static _Bool conf_delete_gauges = 0; -static _Bool conf_delete_sets = 0; +static bool conf_delete_counters = 0; +static bool conf_delete_timers = 0; +static bool conf_delete_gauges = 0; +static bool conf_delete_sets = 0; static double *conf_timer_percentile = NULL; static size_t conf_timer_percentile_num = 0; -static _Bool conf_counter_sum = 0; -static _Bool conf_timer_lower = 0; -static _Bool conf_timer_upper = 0; -static _Bool conf_timer_sum = 0; -static _Bool conf_timer_count = 0; +static bool conf_counter_sum = 0; +static bool conf_timer_lower = 0; +static bool conf_timer_upper = 0; +static bool conf_timer_sum = 0; +static bool conf_timer_count = 0; /* Must hold metrics_lock when calling this function. */ static statsd_metric_t *statsd_metric_lookup_unsafe(char const *name, /* {{{ */ @@ -717,7 +717,7 @@ static int statsd_metric_submit_unsafe(char const *name, if (metric->type == STATSD_GAUGE) vl.values[0].gauge = (gauge_t)metric->value; else if (metric->type == STATSD_TIMER) { - _Bool have_events = (metric->updates_num > 0); + bool have_events = (metric->updates_num > 0); /* Make sure all timer metrics share the *same* timestamp. */ vl.time = cdtime(); diff --git a/src/swap.c b/src/swap.c index dfca67b4..427192ad 100644 --- a/src/swap.c +++ b/src/swap.c @@ -74,14 +74,14 @@ #if KERNEL_LINUX #define SWAP_HAVE_REPORT_BY_DEVICE 1 static derive_t pagesize; -static _Bool report_bytes = 0; -static _Bool report_by_device = 0; +static bool report_bytes = 0; +static bool report_by_device = 0; /* #endif KERNEL_LINUX */ #elif HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS #define SWAP_HAVE_REPORT_BY_DEVICE 1 static derive_t pagesize; -static _Bool report_by_device = 0; +static bool report_by_device = 0; /* #endif HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS */ #elif HAVE_SWAPCTL && HAVE_SWAPCTL_THREE_ARGS @@ -109,9 +109,9 @@ static int pagesize; #error "No applicable input method." #endif /* HAVE_LIBSTATGRAB */ -static _Bool values_absolute = 1; -static _Bool values_percentage = 0; -static _Bool report_io = 1; +static bool values_absolute = 1; +static bool values_percentage = 0; +static bool report_io = 1; static int swap_config(oconfig_item_t *ci) /* {{{ */ { @@ -335,7 +335,7 @@ static int swap_read_io(void) /* {{{ */ FILE *fh; char buffer[1024]; - _Bool old_kernel = 0; + bool old_kernel = 0; uint8_t have_data = 0; derive_t swap_in = 0; diff --git a/src/tail_csv.c b/src/tail_csv.c index f963528b..9331142e 100644 --- a/src/tail_csv.c +++ b/src/tail_csv.c @@ -120,7 +120,7 @@ static int tcsv_read_metric(instance_definition_t *id, metric_definition_t *md, return tcsv_submit(id, md, v, t); } -static _Bool tcsv_check_index(ssize_t index, size_t fields_num, +static bool tcsv_check_index(ssize_t index, size_t fields_num, char const *name) { if (index < 0) return 1; @@ -513,7 +513,7 @@ static int tcsv_config(oconfig_item_t *ci) { } /* int tcsv_config */ static int tcsv_init(void) { /* {{{ */ - static _Bool have_init = 0; + static bool have_init = 0; metric_definition_t *md; if (have_init) diff --git a/src/target_replace.c b/src/target_replace.c index 54d41647..4c8108e5 100644 --- a/src/target_replace.c +++ b/src/target_replace.c @@ -37,7 +37,7 @@ typedef struct tr_action_s tr_action_t; struct tr_action_s { regex_t re; char *replacement; - _Bool may_be_empty; + bool may_be_empty; tr_action_t *next; }; @@ -110,7 +110,7 @@ static void tr_meta_data_action_destroy(tr_meta_data_action_t *act) /* {{{ */ } /* }}} void tr_meta_data_action_destroy */ static int tr_config_add_action(tr_action_t **dest, /* {{{ */ - const oconfig_item_t *ci, _Bool may_be_empty) { + const oconfig_item_t *ci, bool may_be_empty) { tr_action_t *act; int status; @@ -172,7 +172,7 @@ static int tr_config_add_action(tr_action_t **dest, /* {{{ */ static int tr_config_add_meta_action(tr_meta_data_action_t **dest, /* {{{ */ const oconfig_item_t *ci, - _Bool should_delete) { + bool should_delete) { tr_meta_data_action_t *act; int status; @@ -262,7 +262,7 @@ static int tr_config_add_meta_action(tr_meta_data_action_t **dest, /* {{{ */ static int tr_action_invoke(tr_action_t *act_head, /* {{{ */ char *buffer_in, size_t buffer_in_size, - _Bool may_be_empty) { + bool may_be_empty) { int status; char buffer[DATA_MAX_NAME_LEN]; regmatch_t matches[8] = {[0] = {0}}; diff --git a/src/target_v5upgrade.c b/src/target_v5upgrade.c index 49f09f08..12c05d61 100644 --- a/src/target_v5upgrade.c +++ b/src/target_v5upgrade.c @@ -213,7 +213,7 @@ static int v5_mysql_threads(const data_set_t *ds, value_list_t *vl) /* {{{ */ static int v5_zfs_arc_counts(const data_set_t *ds, value_list_t *vl) /* {{{ */ { value_list_t new_vl; - _Bool is_hits; + bool is_hits; if (vl->values_len != 4) return FC_TARGET_STOP; diff --git a/src/testing.h b/src/testing.h index d3da9db4..fed76195 100644 --- a/src/testing.h +++ b/src/testing.h @@ -56,7 +56,7 @@ static int check_count__ = 0; #define OK1(cond, text) \ do { \ - _Bool result = (cond); \ + bool result = (cond); \ LOG(result, text); \ if (!result) { \ return -1; \ diff --git a/src/thermal.c b/src/thermal.c index 9da8fa5f..0f7f79f8 100644 --- a/src/thermal.c +++ b/src/thermal.c @@ -35,7 +35,7 @@ static const char *config_keys[] = {"Device", "IgnoreSelected", static const char *const dirname_sysfs = "/sys/class/thermal"; static const char *const dirname_procfs = "/proc/acpi/thermal_zone"; -static _Bool force_procfs = 0; +static bool force_procfs = 0; static ignorelist_t *device_list; enum dev_type { TEMP = 0, COOLING_DEV }; @@ -59,7 +59,7 @@ static int thermal_sysfs_device_read(const char __attribute__((unused)) * dir, const char *name, void __attribute__((unused)) * user_data) { char filename[PATH_MAX]; - _Bool success = 0; + bool success = 0; value_t value; if (device_list && ignorelist_match(device_list, name)) diff --git a/src/turbostat.c b/src/turbostat.c index 85f7d87f..5e837b81 100644 --- a/src/turbostat.c +++ b/src/turbostat.c @@ -65,12 +65,12 @@ * * This value is automatically set if mperf or aperf go backward */ -static _Bool aperf_mperf_unstable; +static bool aperf_mperf_unstable; /* * If set, use kernel logical core numbering for all "per core" metrics. */ -static _Bool config_lcn; +static bool config_lcn; /* * Bitmask of the list of core C states supported by the processor. @@ -78,7 +78,7 @@ static _Bool config_lcn; */ static unsigned int do_core_cstate; static unsigned int config_core_cstate; -static _Bool apply_config_core_cstate; +static bool apply_config_core_cstate; /* * Bitmask of the list of pacages C states supported by the processor. @@ -86,15 +86,15 @@ static _Bool apply_config_core_cstate; */ static unsigned int do_pkg_cstate; static unsigned int config_pkg_cstate; -static _Bool apply_config_pkg_cstate; +static bool apply_config_pkg_cstate; /* * Boolean indicating if the processor supports 'I/O System-Management Interrupt * counter' */ -static _Bool do_smi; -static _Bool config_smi; -static _Bool apply_config_smi; +static bool do_smi; +static bool config_smi; +static bool apply_config_smi; /* * Boolean indicating if the processor supports 'Digital temperature sensor' @@ -105,9 +105,9 @@ static _Bool apply_config_smi; * might be wrong * - Temperatures above the tcc_activation_temp are not recorded */ -static _Bool do_dts; -static _Bool config_dts; -static _Bool apply_config_dts; +static bool do_dts; +static bool config_dts; +static bool apply_config_dts; /* * Boolean indicating if the processor supports 'Package thermal management' @@ -118,9 +118,9 @@ static _Bool apply_config_dts; * might be wrong * - Temperatures above the tcc_activation_temp are not recorded */ -static _Bool do_ptm; -static _Bool config_ptm; -static _Bool apply_config_ptm; +static bool do_ptm; +static bool config_ptm; +static bool apply_config_ptm; /* * Thermal Control Circuit Activation Temperature as configured by the user. @@ -131,7 +131,7 @@ static unsigned int tcc_activation_temp; static unsigned int do_rapl; static unsigned int config_rapl; -static _Bool apply_config_rapl; +static bool apply_config_rapl; static double rapl_energy_units; #define RAPL_PKG (1 << 0) @@ -195,10 +195,10 @@ static struct pkg_data { #define DELTA_COUNTERS thread_delta, core_delta, package_delta #define ODD_COUNTERS thread_odd, core_odd, package_odd #define EVEN_COUNTERS thread_even, core_even, package_even -static _Bool is_even = 1; +static bool is_even = 1; -static _Bool allocated = 0; -static _Bool initialized = 0; +static bool allocated = 0; +static bool initialized = 0; #define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \ (thread_base + (pkg_no)*topology.num_cores * topology.num_threads + \ @@ -210,8 +210,8 @@ static _Bool initialized = 0; struct cpu_topology { unsigned int package_id; unsigned int core_id; - _Bool first_core_in_package; - _Bool first_thread_in_core; + bool first_core_in_package; + bool first_thread_in_core; }; static struct topology { @@ -246,7 +246,7 @@ static const int config_keys_num = STATIC_ARRAY_SIZE(config_keys); * 1 */ static int __attribute__((warn_unused_result)) -open_msr(unsigned int cpu, _Bool multiple_read) { +open_msr(unsigned int cpu, bool multiple_read) { char pathname[32]; int fd; diff --git a/src/unixsock.c b/src/unixsock.c index bceafe6d..47baffb3 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -62,7 +62,7 @@ static int sock_fd = -1; static char *sock_file = NULL; static char *sock_group = NULL; static int sock_perms = S_IRWXU | S_IRWXG; -static _Bool delete_socket = 0; +static bool delete_socket = 0; static pthread_t listen_thread = (pthread_t)0; diff --git a/src/utils_cmds_test.c b/src/utils_cmds_test.c index bb35ce8c..93bf5129 100644 --- a/src/utils_cmds_test.c +++ b/src/utils_cmds_test.c @@ -191,7 +191,7 @@ DEF_TEST(parse) { cmd_status_t status; cmd_t cmd; - _Bool result; + bool result; memset(&cmd, 0, sizeof(cmd)); diff --git a/src/utils_curl_stats.c b/src/utils_curl_stats.c index 2a1d9de3..09856599 100644 --- a/src/utils_curl_stats.c +++ b/src/utils_curl_stats.c @@ -182,7 +182,7 @@ curl_stats_t *curl_stats_from_config(oconfig_item_t *ci) { oconfig_item_t *c = ci->children + i; size_t field; - _Bool enabled = 0; + bool enabled = 0; for (field = 0; field < STATIC_ARRAY_SIZE(field_specs); ++field) { if (!strcasecmp(c->key, field_specs[field].config_key)) diff --git a/src/utils_format_graphite.c b/src/utils_format_graphite.c index fbeff4f0..6fd02264 100644 --- a/src/utils_format_graphite.c +++ b/src/utils_format_graphite.c @@ -77,7 +77,7 @@ static int gr_format_values(char *ret, size_t ret_len, int ds_num, } static void gr_copy_escape_part(char *dst, const char *src, size_t dst_len, - char escape_char, _Bool preserve_separator) { + char escape_char, bool preserve_separator) { memset(dst, 0, dst_len); if (src == NULL) @@ -116,7 +116,7 @@ static int gr_format_name(char *ret, int ret_len, value_list_t const *vl, if (postfix == NULL) postfix = ""; - _Bool preserve_separator = (flags & GRAPHITE_PRESERVE_SEPARATOR) ? 1 : 0; + bool preserve_separator = (flags & GRAPHITE_PRESERVE_SEPARATOR) ? 1 : 0; gr_copy_escape_part(n_host, vl->host, sizeof(n_host), escape_char, preserve_separator); diff --git a/src/utils_format_json.c b/src/utils_format_json.c index 6a0c6642..42cb4451 100644 --- a/src/utils_format_json.c +++ b/src/utils_format_json.c @@ -267,7 +267,7 @@ static int meta_data_keys_to_json(char *buffer, size_t buffer_size, /* {{{ */ if (meta_data_get_double(meta, key, &value) == 0) BUFFER_ADD(",\"%s\":%f", key, value); } else if (type == MD_TYPE_BOOLEAN) { - _Bool value = 0; + bool value = 0; if (meta_data_get_boolean(meta, key, &value) == 0) BUFFER_ADD(",\"%s\":%s", key, value ? "true" : "false"); } diff --git a/src/utils_format_json_test.c b/src/utils_format_json_test.c index 389004d3..b230ef35 100644 --- a/src/utils_format_json_test.c +++ b/src/utils_format_json_test.c @@ -87,7 +87,7 @@ static int test_map_key(void *ctx, unsigned char const *key, } static int expect_label(char const *name, char const *got, char const *want) { - _Bool ok = (strcmp(got, want) == 0); + bool ok = (strcmp(got, want) == 0); char msg[1024]; if (ok) diff --git a/src/utils_latency_config.h b/src/utils_latency_config.h index 7008fd00..2572fa0d 100644 --- a/src/utils_latency_config.h +++ b/src/utils_latency_config.h @@ -47,9 +47,9 @@ typedef struct { char *bucket_type; /* - _Bool lower; - _Bool upper; - _Bool avg; + bool lower; + bool upper; + bool avg; */ } latency_config_t; diff --git a/src/utils_ovs.c b/src/utils_ovs.c index ca631812..57629a01 100644 --- a/src/utils_ovs.c +++ b/src/utils_ovs.c @@ -209,7 +209,7 @@ static void ovs_db_event_post(ovs_db_t *pdb, int event) { /* Check if POLL thread is still running. Returns * 1 if running otherwise 0 is returned */ -static _Bool ovs_db_poll_is_running(ovs_db_t *pdb) { +static bool ovs_db_poll_is_running(ovs_db_t *pdb) { int state = 0; pthread_mutex_lock(&pdb->poll_thread.mutex); state = pdb->poll_thread.state; diff --git a/src/utils_rrdcreate.h b/src/utils_rrdcreate.h index d5f9a12a..b2277e75 100644 --- a/src/utils_rrdcreate.h +++ b/src/utils_rrdcreate.h @@ -43,7 +43,7 @@ struct rrdcreate_config_s { char **consolidation_functions; size_t consolidation_functions_num; - _Bool async; + bool async; }; typedef struct rrdcreate_config_s rrdcreate_config_t; diff --git a/src/utils_vl_lookup.c b/src/utils_vl_lookup.c index 052c4c0f..6d922462 100644 --- a/src/utils_vl_lookup.c +++ b/src/utils_vl_lookup.c @@ -57,7 +57,7 @@ kstat_ctl_t *kc; struct part_match_s { char str[DATA_MAX_NAME_LEN]; regex_t regex; - _Bool is_regex; + bool is_regex; }; typedef struct part_match_s part_match_t; @@ -114,7 +114,7 @@ typedef struct by_type_entry_s by_type_entry_t; /* * Private functions */ -static _Bool lu_part_matches(part_match_t const *match, /* {{{ */ +static bool lu_part_matches(part_match_t const *match, /* {{{ */ char const *str) { if (match->is_regex) { /* Short cut popular catch-all regex. */ @@ -132,7 +132,7 @@ static _Bool lu_part_matches(part_match_t const *match, /* {{{ */ return 1; else return 0; -} /* }}} _Bool lu_part_matches */ +} /* }}} bool lu_part_matches */ static int lu_copy_ident_to_match_part(part_match_t *match_part, /* {{{ */ char const *ident_part) { @@ -335,7 +335,7 @@ static int lu_handle_user_class_list(lookup_t *obj, /* {{{ */ static by_type_entry_t *lu_search_by_type(lookup_t *obj, /* {{{ */ char const *type, - _Bool allocate_if_missing) { + bool allocate_if_missing) { by_type_entry_t *by_type; char *type_copy; int status; diff --git a/src/utils_vl_lookup_test.c b/src/utils_vl_lookup_test.c index 058015ed..8a71a3a0 100644 --- a/src/utils_vl_lookup_test.c +++ b/src/utils_vl_lookup_test.c @@ -29,8 +29,8 @@ #include "testing.h" #include "utils_vl_lookup.h" -static _Bool expect_new_obj = 0; -static _Bool have_new_obj = 0; +static bool expect_new_obj = 0; +static bool have_new_obj = 0; static lookup_identifier_t last_class_ident; static lookup_identifier_t last_obj_ident; @@ -105,7 +105,7 @@ static int checked_lookup_add(lookup_t *obj, /* {{{ */ static int checked_lookup_search(lookup_t *obj, char const *host, char const *plugin, char const *plugin_instance, char const *type, - char const *type_instance, _Bool expect_new) { + char const *type_instance, bool expect_new) { int status; value_list_t vl = VALUE_LIST_INIT; data_set_t const *ds = &ds_unknown; diff --git a/src/varnish.c b/src/varnish.c index 08260dc2..90008827 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -50,50 +50,50 @@ typedef struct varnish_stats c_varnish_stats_t; struct user_config_s { char *instance; - _Bool collect_cache; - _Bool collect_connections; - _Bool collect_esi; - _Bool collect_backend; + bool collect_cache; + bool collect_connections; + bool collect_esi; + bool collect_backend; #ifdef HAVE_VARNISH_V3 - _Bool collect_dirdns; + bool collect_dirdns; #endif - _Bool collect_fetch; - _Bool collect_hcb; - _Bool collect_objects; + bool collect_fetch; + bool collect_hcb; + bool collect_objects; #if HAVE_VARNISH_V2 - _Bool collect_purge; + bool collect_purge; #else - _Bool collect_ban; + bool collect_ban; #endif - _Bool collect_session; - _Bool collect_shm; - _Bool collect_sms; + bool collect_session; + bool collect_shm; + bool collect_sms; #if HAVE_VARNISH_V2 - _Bool collect_sm; + bool collect_sm; #endif #if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 - _Bool collect_sma; + bool collect_sma; #endif - _Bool collect_struct; - _Bool collect_totals; + bool collect_struct; + bool collect_totals; #if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 - _Bool collect_uptime; + bool collect_uptime; #endif - _Bool collect_vcl; - _Bool collect_workers; + bool collect_vcl; + bool collect_workers; #if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 - _Bool collect_vsm; - _Bool collect_lck; - _Bool collect_mempool; - _Bool collect_mgt; - _Bool collect_smf; - _Bool collect_vbe; - _Bool collect_mse; + bool collect_vsm; + bool collect_lck; + bool collect_mempool; + bool collect_mgt; + bool collect_smf; + bool collect_vbe; + bool collect_mse; #endif }; typedef struct user_config_s user_config_t; /* }}} */ -static _Bool have_instance = 0; +static bool have_instance = 0; static int varnish_submit(const char *plugin_instance, /* {{{ */ const char *category, const char *type, @@ -1331,7 +1331,7 @@ static int varnish_read(user_data_t *ud) /* {{{ */ { #if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 struct VSM_data *vd; - _Bool ok; + bool ok; const c_varnish_stats_t *stats; #elif HAVE_VARNISH_V5 struct vsm *vd; diff --git a/src/virt.c b/src/virt.c index 06e2408f..6f3e5c80 100644 --- a/src/virt.c +++ b/src/virt.c @@ -401,7 +401,7 @@ static const struct ex_stats_item ex_stats_table[] = { }; /* BlockDeviceFormatBasename */ -_Bool blockdevice_format_basename = 0; +bool blockdevice_format_basename = 0; static enum bd_field blockdevice_format = target; static enum if_field interface_format = if_name; @@ -1177,7 +1177,7 @@ static void vcpu_pin_submit(virDomainPtr dom, int max_cpus, int vcpu, unsigned char *cpu_maps, int cpu_map_len) { for (int cpu = 0; cpu < max_cpus; ++cpu) { char type_instance[DATA_MAX_NAME_LEN]; - _Bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0; + bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0; snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu, cpu); submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1); diff --git a/src/write_graphite.c b/src/write_graphite.c index b39448ff..74179121 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -92,7 +92,7 @@ struct wg_callback { char *node; char *service; char *protocol; - _Bool log_send_errors; + bool log_send_errors; char *prefix; char *postfix; char escape_char; @@ -111,7 +111,7 @@ struct wg_callback { /* Force reconnect useful for load balanced environments */ cdtime_t last_reconnect_time; cdtime_t reconnect_interval; - _Bool reconnect_interval_reached; + bool reconnect_interval_reached; }; /* wg_force_reconnect_check closes cb->sock_fd when it was open for longer diff --git a/src/write_http.c b/src/write_http.c index 024dccc1..8cca82d4 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -50,16 +50,16 @@ struct wh_callback_s { char *user; char *pass; char *credentials; - _Bool verify_peer; - _Bool verify_host; + bool verify_peer; + bool verify_host; char *cacert; char *capath; char *clientkey; char *clientcert; char *clientkeypass; long sslversion; - _Bool store_rates; - _Bool log_http_error; + bool store_rates; + bool log_http_error; int low_speed_limit; time_t low_speed_time; int timeout; @@ -68,8 +68,8 @@ struct wh_callback_s { #define WH_FORMAT_JSON 1 #define WH_FORMAT_KAIROSDB 2 int format; - _Bool send_metrics; - _Bool send_notifications; + bool send_metrics; + bool send_notifications; CURL *curl; struct curl_slist *headers; diff --git a/src/write_kafka.c b/src/write_kafka.c index 2baaf0e5..a19dd899 100644 --- a/src/write_kafka.c +++ b/src/write_kafka.c @@ -43,7 +43,7 @@ struct kafka_topic_context { #define KAFKA_FORMAT_GRAPHITE 2 uint8_t format; unsigned int graphite_flags; - _Bool store_rates; + bool store_rates; rd_kafka_topic_conf_t *conf; rd_kafka_topic_t *topic; rd_kafka_conf_t *kafka_conf; diff --git a/src/write_log.c b/src/write_log.c index fdc99ef3..5180a0e7 100644 --- a/src/write_log.c +++ b/src/write_log.c @@ -96,7 +96,7 @@ static int wl_write(const data_set_t *ds, const value_list_t *vl, static int wl_config(oconfig_item_t *ci) /* {{{ */ { - _Bool format_seen = 0; + bool format_seen = 0; for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; diff --git a/src/write_mongodb.c b/src/write_mongodb.c index a6b39d30..f9bd1a0a 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -50,8 +50,8 @@ struct wm_node_s { char *user; char *passwd; - _Bool store_rates; - _Bool connected; + bool store_rates; + bool connected; mongoc_client_t *client; mongoc_database_t *database; @@ -63,7 +63,7 @@ typedef struct wm_node_s wm_node_t; * Functions */ static bson_t *wm_create_bson(const data_set_t *ds, /* {{{ */ - const value_list_t *vl, _Bool store_rates) { + const value_list_t *vl, bool store_rates) { bson_t *ret; bson_t subarray; gauge_t *rates; diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 26b0b4d4..6903aa06 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -244,7 +244,7 @@ static int http_handler(void *cls, struct MHD_Connection *connection, char const *accept = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_ACCEPT); - _Bool want_proto = + bool want_proto = (accept != NULL) && (strstr(accept, "application/vnd.google.protobuf") != NULL); @@ -689,7 +689,7 @@ static char *metric_family_name(data_set_t const *ds, value_list_t const *vl, * necessary. */ static Io__Prometheus__Client__MetricFamily * metric_family_get(data_set_t const *ds, value_list_t const *vl, size_t ds_index, - _Bool allocate) { + bool allocate) { char *name = metric_family_name(ds, vl, ds_index); if (name == NULL) { ERROR("write_prometheus plugin: Allocating metric family name failed."); diff --git a/src/write_redis.c b/src/write_redis.c index 7dd5029c..b2c7598e 100644 --- a/src/write_redis.c +++ b/src/write_redis.c @@ -46,7 +46,7 @@ struct wr_node_s { int database; int max_set_size; int max_set_duration; - _Bool store_rates; + bool store_rates; redisContext *conn; pthread_mutex_t lock; diff --git a/src/write_riemann.c b/src/write_riemann.c index 55699d5d..6515fd4d 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -48,11 +48,11 @@ struct riemann_host { char *name; char *event_service_prefix; pthread_mutex_t lock; - _Bool batch_mode; - _Bool notifications; - _Bool check_thresholds; - _Bool store_rates; - _Bool always_append_ds; + bool batch_mode; + bool notifications; + bool check_thresholds; + bool store_rates; + bool always_append_ds; char *node; int port; riemann_client_type_t client_type; diff --git a/src/write_sensu.c b/src/write_sensu.c index a9f621d7..04f5aa78 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -107,10 +107,10 @@ struct sensu_host { #define F_READY 0x01 uint8_t flags; pthread_mutex_t lock; - _Bool notifications; - _Bool metrics; - _Bool store_rates; - _Bool always_append_ds; + bool notifications; + bool metrics; + bool store_rates; + bool always_append_ds; char *separator; char *node; char *service; diff --git a/src/write_tsdb.c b/src/write_tsdb.c index 3f488a89..a422f372 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -79,8 +79,8 @@ struct wt_callback { char *service; char *host_tags; - _Bool store_rates; - _Bool always_append_ds; + bool store_rates; + bool always_append_ds; char send_buf[WT_SEND_BUF_SIZE]; size_t send_buf_free; @@ -89,7 +89,7 @@ struct wt_callback { pthread_mutex_t send_lock; - _Bool connect_failed_log_enabled; + bool connect_failed_log_enabled; int connect_dns_failed_attempts_remaining; cdtime_t next_random_ttl; }; @@ -313,7 +313,7 @@ static int wt_flush(cdtime_t timeout, static int wt_format_values(char *ret, size_t ret_len, int ds_num, const data_set_t *ds, const value_list_t *vl, - _Bool store_rates) { + bool store_rates) { size_t offset = 0; int status; gauge_t *rates = NULL; -- 2.11.0