Set static bools to true instead of 1
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 13 May 2018 17:05:33 +0000 (19:05 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 13 May 2018 17:05:33 +0000 (19:05 +0200)
21 files changed:
src/amqp.c
src/apcups.c
src/bind.c
src/collectd-tg.c
src/cpu.c
src/daemon/plugin.c
src/df.c
src/fhcount.c
src/hugepages.c
src/interface.c
src/libcollectdclient/network_buffer.c
src/memory.c
src/mic.c
src/nfs.c
src/ntpd.c
src/openvpn.c
src/perl.c
src/processes.c
src/rrdcached.c
src/swap.c
src/turbostat.c

index 5071101..6d65bf8 100644 (file)
@@ -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 pthread_t *subscriber_threads = NULL;
 static size_t subscriber_threads_num = 0;
-static bool subscriber_threads_running = 1;
+static bool subscriber_threads_running = true;
 
 #define CONF(c, f) (((c)->f != NULL) ? (c)->f : def_##f)
 
 
 #define CONF(c, f) (((c)->f != NULL) ? (c)->f : def_##f)
 
index f16da90..622e3a1 100644 (file)
@@ -74,7 +74,7 @@ static char *conf_node = NULL;
 static char *conf_service = NULL;
 /* Defaults to false for backwards compatibility. */
 static bool conf_report_seconds;
 static char *conf_service = NULL;
 /* Defaults to false for backwards compatibility. */
 static bool conf_report_seconds;
-static bool conf_persistent_conn = 1;
+static bool conf_persistent_conn = true;
 
 static int global_sockfd = -1;
 
 
 static int global_sockfd = -1;
 
index 5937d26..7af4269 100644 (file)
@@ -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. */
 
 /* FIXME: Enabled by default for backwards compatibility. */
 /* TODO: Remove time parsing code. */
-static bool config_parse_time = 1;
+static bool config_parse_time = true;
 
 static char *url = NULL;
 static int global_opcodes = 1;
 
 static char *url = NULL;
 static int global_opcodes = 1;
index 85c5c1b..6c0a8a5 100644 (file)
@@ -67,7 +67,7 @@ static c_heap_t *values_heap = NULL;
 static struct sigaction sigint_action;
 static struct sigaction sigterm_action;
 
 static struct sigaction sigint_action;
 static struct sigaction sigterm_action;
 
-static bool loop = 1;
+static bool loop = true;
 
 __attribute__((noreturn)) static void exit_usage(int exit_status) /* {{{ */
 {
 
 __attribute__((noreturn)) static void exit_usage(int exit_status) /* {{{ */
 {
index a0e00d7..6db8629 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -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;
 
  * 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_by_cpu = true;
+static bool report_by_state = true;
 static bool report_percent;
 static bool report_num_cpu;
 static bool report_guest;
 static bool report_percent;
 static bool report_num_cpu;
 static bool report_guest;
-static bool subtract_guest = 1;
+static bool subtract_guest = true;
 
 static const char *config_keys[] = {"ReportByCpu",      "ReportByState",
                                     "ReportNumCpu",     "ValuesPercentage",
 
 static const char *config_keys[] = {"ReportByCpu",      "ReportByState",
                                     "ReportNumCpu",     "ValuesPercentage",
index 3dcd9fc..6752a6c 100644 (file)
@@ -126,7 +126,7 @@ 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 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 = true;
 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 pthread_mutex_t write_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t write_cond = PTHREAD_COND_INITIALIZER;
 static pthread_t *write_threads = NULL;
index 7e4c715..d8108e3 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -57,7 +57,7 @@ static ignorelist_t *il_fstype = NULL;
 
 static bool by_device;
 static bool report_inodes;
 
 static bool by_device;
 static bool report_inodes;
-static bool values_absolute = 1;
+static bool values_absolute = true;
 static bool values_percentage;
 
 static int df_init(void) {
 static bool values_percentage;
 
 static int df_init(void) {
index 9e74dab..0550665 100644 (file)
@@ -25,7 +25,7 @@
 static const char *config_keys[] = {"ValuesAbsolute", "ValuesPercentage"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
 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_absolute = true;
 static bool values_percentage;
 
 static int fhcount_config(const char *key, const char *value) {
 static bool values_percentage;
 
 static int fhcount_config(const char *key, const char *value) {
index 23db25b..adfc5bb 100644 (file)
 
 static const char g_plugin_name[] = "hugepages";
 
 
 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 = true;
+static bool g_flag_rpt_mm = true;
 
 
-static bool g_values_pages = 1;
+static bool g_values_pages = true;
 static bool g_values_bytes;
 static bool g_values_percent;
 
 static bool g_values_bytes;
 static bool g_values_percent;
 
index e0e08c3..39ca880 100644 (file)
@@ -88,7 +88,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
 static ignorelist_t *ignorelist = NULL;
 
 
 static ignorelist_t *ignorelist = NULL;
 
-static bool report_inactive = 1;
+static bool report_inactive = true;
 
 #ifdef HAVE_LIBKSTAT
 #if HAVE_KSTAT_H
 
 #ifdef HAVE_LIBKSTAT
 #if HAVE_KSTAT_H
index 07d3e76..2332e3e 100644 (file)
@@ -126,7 +126,7 @@ struct lcc_network_buffer_s {
 static bool have_gcrypt(void) /* {{{ */
 {
   static bool result;
 static bool have_gcrypt(void) /* {{{ */
 {
   static bool result;
-  static bool need_init = 1;
+  static bool need_init = true;
 
   if (!need_init)
     return result;
 
   if (!need_init)
     return result;
index ce9ef83..366ca1c 100644 (file)
@@ -94,7 +94,7 @@ static int pagesize;
 #error "No applicable input method."
 #endif
 
 #error "No applicable input method."
 #endif
 
-static bool values_absolute = 1;
+static bool values_absolute = true;
 static bool values_percentage;
 
 static int memory_config(oconfig_item_t *ci) /* {{{ */
 static bool values_percentage;
 
 static int memory_config(oconfig_item_t *ci) /* {{{ */
index 55bc684..b65679e 100644 (file)
--- 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);
 
     "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 = true;
+static bool show_cpu_cores = true;
+static bool show_memory = true;
+static bool show_temps = true;
 static ignorelist_t *temp_ignore = NULL;
 static ignorelist_t *temp_ignore = NULL;
-static bool show_power = 1;
+static bool show_power = true;
 static ignorelist_t *power_ignore = NULL;
 
 static int mic_init(void) {
 static ignorelist_t *power_ignore = NULL;
 
 static int mic_init(void) {
index 8d5b630..e031cb7 100644 (file)
--- 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 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 = true;
+static bool report_v3 = true;
+static bool report_v4 = true;
 
 /*
 see /proc/net/rpc/nfs
 
 /*
 see /proc/net/rpc/nfs
index d0cd94c..1827dc3 100644 (file)
@@ -56,7 +56,7 @@ static const char *config_keys[] = {"Host", "Port", "ReverseLookups",
                                     "IncludeUnitID"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
                                     "IncludeUnitID"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
-static bool do_reverse_lookups = 1;
+static bool do_reverse_lookups = true;
 
 /* 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
 
 /* 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
index 30254f0..a80c09f 100644 (file)
@@ -81,9 +81,9 @@ struct vpn_status_s {
 typedef struct vpn_status_s vpn_status_t;
 
 static bool new_naming_schema;
 typedef struct vpn_status_s vpn_status_t;
 
 static bool new_naming_schema;
-static bool collect_compression = 1;
+static bool collect_compression = true;
 static bool collect_user_count;
 static bool collect_user_count;
-static bool collect_individual_users = 1;
+static bool collect_individual_users = true;
 
 static const char *config_keys[] = {
     "StatusFile",           "Compression", /* old, deprecated name */
 
 static const char *config_keys[] = {
     "StatusFile",           "Compression", /* old, deprecated name */
index cdacbb7..8c57f57 100644 (file)
@@ -183,7 +183,7 @@ extern char **environ;
  * private variables
  */
 
  * private variables
  */
 
-static bool register_legacy_flush = 1;
+static bool register_legacy_flush = true;
 
 /* if perl_threads != NULL perl_threads->head must
  * point to the "base" thread */
 
 /* if perl_threads != NULL perl_threads->head must
  * point to the "base" thread */
index 12a63df..d283d3e 100644 (file)
@@ -295,7 +295,7 @@ typedef struct procstat {
 
 static procstat_t *list_head_g = NULL;
 
 
 static procstat_t *list_head_g = NULL;
 
-static bool want_init = 1;
+static bool want_init = true;
 static bool report_ctx_switch;
 static bool report_fd_num;
 static bool report_maps_num;
 static bool report_ctx_switch;
 static bool report_fd_num;
 static bool report_maps_num;
index f9c2af3..3d7ae05 100644 (file)
@@ -39,8 +39,8 @@
  */
 static char *datadir = NULL;
 static char *daemon_address = NULL;
  */
 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 = true;
+static bool config_collect_stats = true;
 static rrdcreate_config_t rrdcreate_config = {
     /* stepsize = */ 0,
     /* heartbeat = */ 0,
 static rrdcreate_config_t rrdcreate_config = {
     /* stepsize = */ 0,
     /* heartbeat = */ 0,
index 5fdb6ea..2e0939d 100644 (file)
@@ -109,9 +109,9 @@ static int pagesize;
 #error "No applicable input method."
 #endif /* HAVE_LIBSTATGRAB */
 
 #error "No applicable input method."
 #endif /* HAVE_LIBSTATGRAB */
 
-static bool values_absolute = 1;
+static bool values_absolute = true;
 static bool values_percentage;
 static bool values_percentage;
-static bool report_io = 1;
+static bool report_io = true;
 
 static int swap_config(oconfig_item_t *ci) /* {{{ */
 {
 
 static int swap_config(oconfig_item_t *ci) /* {{{ */
 {
index 89bf3cb..9a8d7a1 100644 (file)
@@ -195,7 +195,7 @@ 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
 #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 = true;
 
 static bool allocated;
 static bool initialized;
 
 static bool allocated;
 static bool initialized;