]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
No need to initialize static bools to false
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 13 May 2018 16:56:18 +0000 (18:56 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 13 May 2018 16:56:18 +0000 (18:56 +0200)
35 files changed:
src/apcups.c
src/barometer.c
src/battery.c
src/collectd-nagios.c
src/cpu.c
src/daemon/plugin.c
src/daemon/utils_random.c
src/df.c
src/disk.c
src/ethstat.c
src/fhcount.c
src/hugepages.c
src/interface.c
src/libcollectdclient/network_buffer.c
src/load.c
src/lpar.c
src/memcached.c
src/memory.c
src/network.c
src/ntpd.c
src/onewire.c
src/openvpn.c
src/pinba.c
src/postgresql.c
src/processes.c
src/python.c
src/sensors.c
src/statsd.c
src/swap.c
src/tail_csv.c
src/thermal.c
src/turbostat.c
src/unixsock.c
src/utils_vl_lookup_test.c
src/varnish.c

index 2fa247995dde93f64321233d247e591b119d78d7..f16da90e8daf4323f15ac2945431e5ceb87395c3 100644 (file)
@@ -73,7 +73,7 @@ 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_report_seconds;
 static bool conf_persistent_conn = 1;
 
 static int global_sockfd = -1;
index be8198acee37d4f200019b5db586405b63d1a86b..f21cdafeb2d7f156258755d1dd940f52a5fae5ac 100644 (file)
@@ -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; /**< 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; /**< already initialized by real values */
 
 typedef struct averaging_s {
   long int *ring_buffer;
index 74e279614e91bd78888de9b11a0793862812c0cf..0e2667c95ef66bc099d7b9b9afaf067fafa0cd46 100644 (file)
@@ -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;
+static bool report_degraded;
+static bool query_statefs;
 
 static void battery_submit2(char const *plugin_instance, /* {{{ */
                             char const *type, char const *type_instance,
index 27d5622f1afa188dc0ba552a74a938b52dc2d5b0..d53ae655e555ec38d4ee4b0027e2398bbf790531 100644 (file)
@@ -101,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;
 
 static char **match_ds_g = NULL;
 static size_t match_ds_num_g = 0;
index 42fcbed973748fa52d82a72c0305e177ab562069..a0e00d74f4451832291f315f2e8c7bb161ea262d 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -196,9 +196,9 @@ 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 report_percent;
+static bool report_num_cpu;
+static bool report_guest;
 static bool subtract_guest = 1;
 
 static const char *config_keys[] = {"ReportByCpu",      "ReportByState",
index eb2695875f36ed5af557a182aa9b306aa6a0d02e..3dcd9fce58f5539249ee7011c6a2b7753db3be88 100644 (file)
@@ -133,13 +133,13 @@ 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;
 
 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;
 
 /*
  * Static functions
index def0ba685b51b704520934687cdea5d2ada744d6..e3ce34cdd5ec573df771e924540ba9f075545ea9 100644 (file)
@@ -32,7 +32,7 @@
 #include <pthread.h>
 
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-static bool have_seed = 0;
+static bool have_seed;
 static unsigned short seed[3];
 
 static void cdrand_seed(void) {
index 5c08ca4a145bdf91ccb514b3e36a7da4d0efd582..7e4c715e02fec3c52ed4063b183c859d8c54ed38 100644 (file)
--- 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 by_device;
+static bool report_inodes;
 static bool values_absolute = 1;
-static bool values_percentage = 0;
+static bool values_percentage;
 
 static int df_init(void) {
   if (il_device == NULL)
index 317e10541081c03b4eea2415d8fa0be6bc28ab7c..506c0e0a55c971e6db87e7f0d88fdab439055c07 100644 (file)
@@ -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;
 /* #endif HAVE_IOKIT_IOKITLIB_H */
 
 #elif KERNEL_LINUX
index c234d7e852531bd54ed63c01d58e954afc94a8d6..316c25fcc3a6f728b5daac223b6de852146b9a22 100644 (file)
@@ -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;
 
 static int ethstat_add_interface(const oconfig_item_t *ci) /* {{{ */
 {
index 1e84efa914963d40f4e7d8fa24d5d09a56b695d2..9e74dabd79a5582a7ce0c9c7fb5e53ac44bb2a66 100644 (file)
@@ -26,7 +26,7 @@ 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_percentage;
 
 static int fhcount_config(const char *key, const char *value) {
   int ret = -1;
index 9515046029406fd6ad1b06639a00aebc3d341bc1..23db25bfdb6f129a5609c368ad0b4a9a9f4d3a1e 100644 (file)
@@ -39,8 +39,8 @@ 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_bytes;
+static bool g_values_percent;
 
 #define HP_HAVE_NR 0x01
 #define HP_HAVE_SURPLUS 0x02
index 64764d518e302c5a53c741fbecf57533db77b5bb..e0e08c395d194c2ba3d69dd8b67b8525e262a854 100644 (file)
@@ -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;
 #endif /* HAVE_LIBKSTAT */
 
 static int interface_config(const char *key, const char *value) {
index 755d476cab5daf59e52f142537ba6eae95f6f6cb..07d3e7676469a5cf4905350213de230e85a92ca0 100644 (file)
@@ -125,7 +125,7 @@ struct lcc_network_buffer_s {
  */
 static bool have_gcrypt(void) /* {{{ */
 {
-  static bool result = 0;
+  static bool result;
   static bool need_init = 1;
 
   if (!need_init)
index ac07fa642d9b2a5c21305c3e5a15fe9af92b7c5f..4bc93d5ec72430d3f7f2116d83bcb73efeb7f8bb 100644 (file)
@@ -55,7 +55,7 @@
 #include <sys/protosw.h>
 #endif /* HAVE_PERFSTAT */
 
-static bool report_relative_load = 0;
+static bool report_relative_load;
 
 static const char *config_keys[] = {"ReportRelative"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
index 367ebcdc7f53d067cd187c3018afec46d73bfb64..77e6d087daaa879df00be7a5b84411ca568ffae7 100644 (file)
 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;
+static bool report_by_serial;
 #if PERFSTAT_SUPPORTS_DONATION
-static bool donate_flag = 0;
+static bool donate_flag;
 #endif
 static char serial[SYS_NMLN];
 
index 95a9edad5e5135890864bd71802b9ac487351ae7..45796146b8e98172a3f2dea5ef1e689bc6171b10 100644 (file)
@@ -69,7 +69,7 @@ struct memcached_s {
 };
 typedef struct memcached_s memcached_t;
 
-static bool memcached_have_instances = 0;
+static bool memcached_have_instances;
 
 static void memcached_free(void *arg) {
   memcached_t *st = arg;
index 336a6307db76dd9c3e54a68919c4225594841444..ce9ef834d181fe0fddae15a786fb60f7f3054ba0 100644 (file)
@@ -95,7 +95,7 @@ static int pagesize;
 #endif
 
 static bool values_absolute = 1;
-static bool values_percentage = 0;
+static bool values_percentage;
 
 static int memory_config(oconfig_item_t *ci) /* {{{ */
 {
index 3b5a0f2de69d07a7f2b16265708c746fe35644af..270bed29405c1778361600080e1b70f8d2d5caa4 100644 (file)
@@ -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;
+static bool network_config_stats;
 
 static sockent_t *sending_sockets = NULL;
 
@@ -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;
 
   /* Check if we were already initialized. If so, just return - there's
    * nothing more to do (for now, that is). */
index ffb71b0331ca92afa24e2acf260c2dc88c9e45f5..d0cd94cb2950910a970d4f99ba90cea1d93920d4 100644 (file)
@@ -61,7 +61,7 @@ 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;
 
 #define NTPD_DEFAULT_HOST "localhost"
 #define NTPD_DEFAULT_PORT "123"
index 65c071b5cc459025a52a762e2e53f2c552418084..1803d264bd1aecbb5d26bf6ac08788148713bd06 100644 (file)
@@ -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;
 
 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;
 static regex_t regex_direct;
 
 /**
index 4c3e464de978ed313b0358e71b39fa97fe76b6f8..30254f0de6b3dcbd2cc8a4b5bca129ac1e69a511 100644 (file)
@@ -80,9 +80,9 @@ struct vpn_status_s {
 };
 typedef struct vpn_status_s vpn_status_t;
 
-static bool new_naming_schema = 0;
+static bool new_naming_schema;
 static bool collect_compression = 1;
-static bool collect_user_count = 0;
+static bool collect_user_count;
 static bool collect_individual_users = 1;
 
 static const char *config_keys[] = {
index 02bdcc2bb513e5e3f29160b3ccd99fb20958c027..9620f1b8fa813b6fca6b0af32a10d8ab74352ef1 100644 (file)
@@ -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;
+static bool collector_thread_do_shutdown;
 static pthread_t collector_thread_id;
 /* }}} */
 
index 7316c5478e449a82d0b0576a10cf6b2f15523e01..803b63be0e0d682034e110f876c562a2d0d45ddd 100644 (file)
@@ -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;
 
   if ((1 != ci->values_num) || (OCONFIG_TYPE_STRING != ci->values[0].type)) {
     log_err("<Database> expects a single string argument.");
index 8e11175adea8ef7e158c6895a0ac846982a74c99..12a63df67877c062962a809fec9d87ebb81876b5 100644 (file)
@@ -296,10 +296,10 @@ 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 report_ctx_switch;
+static bool report_fd_num;
+static bool report_maps_num;
+static bool report_delay;
 
 #if HAVE_THREAD_INFO
 static mach_port_t port_host_self;
index 178f52d279975c0ea2d02e0dcaefd237110e5acf..53b3806c4813cb3dd0abf2d6bc4590d77b18a248 100644 (file)
@@ -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;
 
 /* 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
index 4d8e92569b84a31752087f0bb9e632dd8852c8b4..3969dc9a8fc6779e1ecf54dad0b82e6d4cabb53a 100644 (file)
@@ -158,7 +158,7 @@ typedef struct featurelist {
 } featurelist_t;
 
 static char *conffile = NULL;
-static bool use_labels = 0;
+static bool use_labels;
 /* #endif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */
 
 #else /* if SENSORS_API_VERSION >= 0x500 */
index 34ce586390ad65e8c49d1e0a8ccafe58191013fc..70c1a752fdf8f2a758a30fa3784d12b41b026f11 100644 (file)
@@ -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;
+static bool network_thread_shutdown;
 
 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;
+static bool conf_delete_timers;
+static bool conf_delete_gauges;
+static bool conf_delete_sets;
 
 static double *conf_timer_percentile = NULL;
-static size_t conf_timer_percentile_num = 0;
+static size_t conf_timer_percentile_num;
 
-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;
+static bool conf_timer_lower;
+static bool conf_timer_upper;
+static bool conf_timer_sum;
+static bool conf_timer_count;
 
 /* Must hold metrics_lock when calling this function. */
 static statsd_metric_t *statsd_metric_lookup_unsafe(char const *name, /* {{{ */
index 427192ad8981b66385b6a5c2201e4a0262b77c4d..5fdb6ea88b0e85fcf1a0b97061e05da15f3112ba 100644 (file)
 #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;
+static bool report_by_device;
 /* #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;
 /* #endif HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS */
 
 #elif HAVE_SWAPCTL && HAVE_SWAPCTL_THREE_ARGS
@@ -110,7 +110,7 @@ static int pagesize;
 #endif /* HAVE_LIBSTATGRAB */
 
 static bool values_absolute = 1;
-static bool values_percentage = 0;
+static bool values_percentage;
 static bool report_io = 1;
 
 static int swap_config(oconfig_item_t *ci) /* {{{ */
index 9331142e95547fbfddd7d7e9b57bbeb4f3f9a292..23281136e8a2ef964adb153daa715b038cdefe6c 100644 (file)
@@ -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;
   metric_definition_t *md;
 
   if (have_init)
index 0f7f79f8123b28f9c37badd6e48c65d6e3aefc98..cbd168b41bad622c09e86dd803eb8f52d17a1ca5 100644 (file)
@@ -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;
 static ignorelist_t *device_list;
 
 enum dev_type { TEMP = 0, COOLING_DEV };
index 5e837b81d36c7fa44046afccee4388dacade655e..89bf3cb51cba6e2df4fc9e0e08f4f8a0192debe3 100644 (file)
@@ -197,8 +197,8 @@ static struct pkg_data {
 #define EVEN_COUNTERS thread_even, core_even, package_even
 static bool is_even = 1;
 
-static bool allocated = 0;
-static bool initialized = 0;
+static bool allocated;
+static bool initialized;
 
 #define GET_THREAD(thread_base, thread_no, core_no, pkg_no)                    \
   (thread_base + (pkg_no)*topology.num_cores * topology.num_threads +          \
index 47baffb3f195d848bf32b945cae199fd303a68be..67edab176f033522fa195b97f35d934e0352db30 100644 (file)
@@ -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;
 
 static pthread_t listen_thread = (pthread_t)0;
 
index 8a71a3a0e50e3d1f2efec6b1ff655b2bfd1054d5..d7226b97037e91c8c607885d8144781bb2e3bf1f 100644 (file)
@@ -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;
+static bool have_new_obj;
 
 static lookup_identifier_t last_class_ident;
 static lookup_identifier_t last_obj_ident;
index 900088277470f1bfe153aa7fdd51664731a07544..0d939935ec4777460fc0c3637d289c6b9094cf04 100644 (file)
@@ -93,7 +93,7 @@ struct user_config_s {
 };
 typedef struct user_config_s user_config_t; /* }}} */
 
-static bool have_instance = 0;
+static bool have_instance;
 
 static int varnish_submit(const char *plugin_instance, /* {{{ */
                           const char *category, const char *type,