]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Don't initialize static numeric variables to 0 2772/head
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 14 May 2018 12:10:34 +0000 (14:10 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 14 May 2018 12:12:58 +0000 (14:12 +0200)
62 files changed:
src/amqp.c
src/apcups.c
src/ascent.c
src/barometer.c
src/bind.c
src/ceph.c
src/collectd-nagios.c
src/collectdmon.c
src/conntrack.c
src/cpu.c
src/cpufreq.c
src/csv.c
src/daemon/collectd.c
src/daemon/filter_chain.c
src/daemon/plugin.c
src/daemon/utils_avltree_test.c
src/dbi.c
src/disk.c
src/dns.c
src/email.c
src/ethstat.c
src/filecount.c
src/gmond.c
src/interface.c
src/iptables.c
src/java.c
src/libcollectdclient/network_buffer.c
src/libcollectdclient/network_parse.c
src/logfile.c
src/madwifi.c
src/mic.c
src/mqtt.c
src/netlink.c
src/network.c
src/nfs.c
src/nginx.c
src/notify_email.c
src/nut.c
src/onewire.c
src/oracle.c
src/perl.c
src/pinba.c
src/ping.c
src/postgresql.c
src/python.c
src/rrdtool.c
src/sensors.c
src/smart.c
src/snmp.c
src/syslog.c
src/tail.c
src/tape.c
src/tcpconns.c
src/ted.c
src/testing.h
src/unixsock.c
src/utils_dns.c
src/utils_ovs.c
src/virt.c
src/vmem.c
src/vserver.c
src/write_tsdb.c

index 7a91ba1122453006a4903ca374d7c437355ad7e9..281130b142bd66f6f8664be5c02f5f3c92f0013f 100644 (file)
@@ -112,7 +112,7 @@ static const char *def_password = "guest";
 static const char *def_exchange = "amq.fanout";
 
 static pthread_t *subscriber_threads;
-static size_t subscriber_threads_num = 0;
+static size_t subscriber_threads_num;
 static bool subscriber_threads_running = true;
 
 #define CONF(c, f) (((c)->f != NULL) ? (c)->f : def_##f)
@@ -396,7 +396,7 @@ static int camqp_setup_queue(camqp_config_t *conf) /* {{{ */
 
 static int camqp_connect(camqp_config_t *conf) /* {{{ */
 {
-  static time_t last_connect_time = 0;
+  static time_t last_connect_time;
 
   amqp_rpc_reply_t reply;
   int status;
index 4e84ebd22ff8a5f6c80f26000c4e5eaa7b234186..2931d2c08d146d4ba8210dd0ac4bb95d01e5f1c5 100644 (file)
@@ -78,8 +78,8 @@ static bool conf_persistent_conn = true;
 
 static int global_sockfd = -1;
 
-static int count_retries = 0;
-static int count_iterations = 0;
+static int count_retries;
+static int count_iterations;
 
 static int net_shutdown(int *fd) {
   uint16_t packet_size = 0;
index 09dd5de7e0ca829addf66d5dac8a5f2e191ec329..223586589c6703fb8235c667ce648384a55be117 100644 (file)
@@ -98,8 +98,8 @@ static char *timeout;
 static CURL *curl;
 
 static char *ascent_buffer;
-static size_t ascent_buffer_size = 0;
-static size_t ascent_buffer_fill = 0;
+static size_t ascent_buffer_size;
+static size_t ascent_buffer_fill;
 static char ascent_curl_error[CURL_ERROR_SIZE];
 
 static const char *config_keys[] = {
index 17c2a1a2398d3579694b97082584526dd5344b78..66ab20c02427b814788adca24d55784c475b8284 100644 (file)
@@ -180,11 +180,11 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 static char *config_device;       /**< I2C bus device */
 static int config_oversample = 1; /**< averaging window */
 
-static double config_press_offset = 0.0; /**< pressure offset */
-static double config_temp_offset = 0.0;  /**< temperature offset */
+static double config_press_offset; /**< pressure offset */
+static double config_temp_offset;  /**< temperature offset */
 
 static double config_altitude = NAN; /**< altitude */
-static int config_normalize = 0;     /**< normalization method */
+static int config_normalize;         /**< normalization method */
 
 static bool configured; /**< the whole plugin config status */
 
@@ -193,7 +193,7 @@ static int i2c_bus_fd = -1; /**< I2C bus device FD */
 static enum Sensor_type sensor_type =
     Sensor_none; /**< detected/used sensor type */
 
-static __s32 mpl3115_oversample = 0; /**< MPL3115 CTRL1 oversample setting */
+static __s32 mpl3115_oversample; /**< MPL3115 CTRL1 oversample setting */
 
 // BMP085 configuration
 static unsigned bmp085_oversampling; /**< BMP085 oversampling (0-3) */
index 2d10aba86eb0087b287f70d48f22a8712d0d7b5b..370ebc58dc0710afcc874c483a474b3be97aa3a8 100644 (file)
@@ -111,18 +111,18 @@ static int global_opcodes = 1;
 static int global_qtypes = 1;
 static int global_server_stats = 1;
 static int global_zone_maint_stats = 1;
-static int global_resolver_stats = 0;
+static int global_resolver_stats;
 static int global_memory_stats = 1;
 static int timeout = -1;
 
 static cb_view_t *views;
-static size_t views_num = 0;
+static size_t views_num;
 
 static CURL *curl;
 
 static char *bind_buffer;
-static size_t bind_buffer_size = 0;
-static size_t bind_buffer_fill = 0;
+static size_t bind_buffer_size;
+static size_t bind_buffer_fill;
 static char bind_curl_error[CURL_ERROR_SIZE];
 
 /* Translation table for the `nsstats' values. */
index e2c98ed09c01fdd21c735a1380b611f544efb202..2622dc7330179f03563b62782cc4b5a2e9cd5128 100644 (file)
@@ -148,7 +148,7 @@ enum perfcounter_type_d {
 };
 
 /** Give user option to use default (long run = since daemon started) avg */
-static int long_run_latency_avg = 0;
+static int long_run_latency_avg;
 
 /**
  * Give user option to use default type for special cases -
@@ -164,7 +164,7 @@ static int convert_special_metrics = 1;
 static struct ceph_daemon **g_daemons;
 
 /** Number of elements in g_daemons */
-static size_t g_num_daemons = 0;
+static size_t g_num_daemons;
 
 /**
  * A set of data that we build up in memory while parsing the JSON.
index 68ed437c95695cf9d3b6b95bbc776d7e9a3140d3..54be36aaee3363d8217594c40b033e98430ecc9e 100644 (file)
@@ -104,7 +104,7 @@ static int consolitation_g = CON_NONE;
 static bool nan_is_error_g;
 
 static char **match_ds_g;
-static size_t match_ds_num_g = 0;
+static size_t match_ds_num_g;
 
 /* `strdup' is an XSI extension. I don't want to pull in all of XSI just for
  * that, so here's an own implementation.. It's easy enough. The GCC attributes
index 6c198895b964693fc5e8650826338d81b95c929e..089e52b66c3dbeb167727017006a5b5d13f18173 100644 (file)
 #define WCOREDUMP(s) 0
 #endif /* ! WCOREDUMP */
 
-static int loop = 0;
-static int restart = 0;
+static int loop;
+static int restart;
 
 static const char *pidfile;
-static pid_t collectd_pid = 0;
+static pid_t collectd_pid;
 
 __attribute__((noreturn)) static void exit_usage(const char *name) {
   printf("Usage: %s <options> [-- <collectd options>]\n"
@@ -246,8 +246,8 @@ static void log_status(int status) {
 static void check_respawn(void) {
   time_t t = time(NULL);
 
-  static time_t timestamp = 0;
-  static int counter = 0;
+  static time_t timestamp;
+  static int counter;
 
   if ((t - 120) < timestamp)
     ++counter;
index 3cd2deeed3553412a6bfdf6ce672409b8d4aafce..29c7003e9296dfaebb44cb9fa0892db2bcbb981a 100644 (file)
@@ -41,7 +41,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
     Each table/chain combo that will be queried goes into this list
 */
 
-static int old_files = 0;
+static int old_files;
 
 static int conntrack_config(const char *key, const char *value) {
   if (strcmp(key, "OldFiles") == 0)
index 7478a4abbf92438381eb11d386326ccc5aa0f6d7..2a6971292a5ca676b2466308eaf62a226a2130c7 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -188,11 +188,11 @@ struct cpu_state_s {
 typedef struct cpu_state_s cpu_state_t;
 
 static cpu_state_t *cpu_states;
-static size_t cpu_states_num = 0; /* #cpu_states allocated */
+static size_t cpu_states_num; /* #cpu_states allocated */
 
 /* Highest CPU number in the current iteration. Used by the dispatch logic to
  * determine how many CPUs there were. Reset to 0 by cpu_reset(). */
-static size_t global_cpu_num = 0;
+static size_t global_cpu_num;
 
 static bool report_by_cpu = true;
 static bool report_by_state = true;
index 0139947e57527d76bba5353fd132c86a6c5d9f65..851aad420ba9eca17f3ccb729b3e7d718ffd98f2 100644 (file)
@@ -25,7 +25,7 @@
 #include "common.h"
 #include "plugin.h"
 
-static int num_cpu = 0;
+static int num_cpu;
 
 static int cpufreq_init(void) {
   int status;
index 34fc2238da1bcae7143b0da23ff8bd5127f29afa..be59ede03ef27a12373a3a07b1ea73d2f12f4e5b 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
@@ -34,8 +34,8 @@ static const char *config_keys[] = {"DataDir", "StoreRates"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
 static char *datadir;
-static int store_rates = 0;
-static int use_stdio = 0;
+static int store_rates;
+static int use_stdio;
 
 static int value_list_to_string(char *buffer, int buffer_len,
                                 const data_set_t *ds, const value_list_t *vl) {
index 3b959c76555461dab3621c3fc8fa31183d5e6ad6..d15bb33404a4c7ca200b18602a67c5fa5331c262 100644 (file)
@@ -51,7 +51,7 @@
 #define COLLECTD_LOCALE "C"
 #endif
 
-static int loop = 0;
+static int loop;
 
 static void *do_flush(void __attribute__((unused)) * arg) {
   INFO("Flushing all data.");
index 1352f5b39735812c16a16733c96722f312c1ba39..a0a768760a68446aba0aee1d1a70cd17f2500fcf 100644 (file)
@@ -693,7 +693,7 @@ static int fc_bit_write_invoke(const data_set_t *ds, /* {{{ */
 
 static int fc_init_once(void) /* {{{ */
 {
-  static int done = 0;
+  static int done;
   target_proc_t tproc = {0};
 
   if (done != 0)
index 5374d8d246211749555b28449de689aac259de59..427a813485adeeefb325c298d3b641fd62e41fa4 100644 (file)
@@ -120,25 +120,25 @@ static int read_loop = 1;
 static pthread_mutex_t read_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t read_cond = PTHREAD_COND_INITIALIZER;
 static pthread_t *read_threads;
-static size_t read_threads_num = 0;
+static size_t read_threads_num;
 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 long write_queue_length;
 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;
-static size_t write_threads_num = 0;
+static size_t write_threads_num;
 
 static pthread_key_t plugin_ctx_key;
 static bool plugin_ctx_key_initialized;
 
-static long write_limit_high = 0;
-static long write_limit_low = 0;
+static long write_limit_high;
+static long write_limit_low;
 
-static derive_t stats_values_dropped = 0;
+static derive_t stats_values_dropped;
 static bool record_statistics;
 
 /*
@@ -2025,7 +2025,7 @@ static double get_drop_probability(void) /* {{{ */
 
 static bool check_drop_value(void) /* {{{ */
 {
-  static cdtime_t last_message_time = 0;
+  static cdtime_t last_message_time;
   static pthread_mutex_t last_message_lock = PTHREAD_MUTEX_INITIALIZER;
 
   double p;
index bb30f9d6fe23a36e829bf07d00eceb9fce042f8c..3171246a15c71a5edf3039da142ec557e938a2da 100644 (file)
  *   Florian octo Forster <octo at collectd.org>
  */
 
-#include "common.h" /* STATIC_ARRAY_SIZE */
 #include "collectd.h"
+#include "common.h" /* STATIC_ARRAY_SIZE */
 
 #include "testing.h"
 #include "utils_avltree.h"
 
-static int compare_total_count = 0;
+static int compare_total_count;
+
 #define RESET_COUNTS()                                                         \
   do {                                                                         \
     compare_total_count = 0;                                                   \
index dcc32e68531e86d7cbef997da9248a2ad64b9404..4ef9f8c59f3fe5f08fb39b714366ae4ab37cf630 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
@@ -83,12 +83,12 @@ typedef struct cdbi_database_s cdbi_database_t; /* }}} */
  * Global variables
  */
 #if !defined(HAVE_LEGACY_LIBDBI) || !HAVE_LEGACY_LIBDBI
-static dbi_inst dbi_instance = 0;
+static dbi_inst dbi_instance;
 #endif
 static udb_query_t **queries;
-static size_t queries_num = 0;
+static size_t queries_num;
 static cdbi_database_t **databases;
-static size_t databases_num = 0;
+static size_t databases_num;
 
 static int cdbi_read_database(user_data_t *ud);
 
@@ -407,7 +407,7 @@ static int cdbi_config(oconfig_item_t *ci) /* {{{ */
 
 static int cdbi_init(void) /* {{{ */
 {
-  static int did_init = 0;
+  static int did_init;
   int status;
 
   if (did_init != 0)
index 7b5c02498d84e71421e359bc26c190edb5f3fea5..206862baab4ebea4cfa809a7e4e57774e7be5a5a 100644 (file)
@@ -126,7 +126,7 @@ static struct gmesh geom_tree;
 #define MAX_NUMDISK 1024
 extern kstat_ctl_t *kc;
 static kstat_t *ksp[MAX_NUMDISK];
-static int numdisk = 0;
+static int numdisk;
 /* #endif HAVE_LIBKSTAT */
 
 #elif defined(HAVE_LIBSTATGRAB)
index ef627eb8115969a6dd079101ff3083b447d2a25a..bd6820fa6b24aa1b958581ed34d62b4a3d7d6ab1 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -66,7 +66,7 @@ static counter_list_t *opcode_list;
 static counter_list_t *rcode_list;
 
 static pthread_t listen_thread;
-static int listen_thread_init = 0;
+static int listen_thread_init;
 /* The `traffic' mutex if for `tr_queries' and `tr_responses' */
 static pthread_mutex_t traffic_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t qtype_mutex = PTHREAD_MUTEX_INITIALIZER;
index 4f49cfb393e17c6b1cb1d293b5405869d62b00ba..376dd6a53dd6a61ad99e5df488671b0c573f5ccc 100644 (file)
@@ -117,7 +117,7 @@ static int sock_perms = S_IRWXU | S_IRWXG;
 static int max_conns = MAX_CONNS;
 
 /* state of the plugin */
-static int disabled = 0;
+static int disabled;
 
 /* thread managing "client" connections */
 static pthread_t connector = (pthread_t)0;
index 371020c97b2b4a99cc1c790a7d4afb93239b7550..0d4c7e1522a6d28a18a52b7a21a9c4e59d9fc516 100644 (file)
@@ -49,7 +49,7 @@ struct value_map_s {
 typedef struct value_map_s value_map_t;
 
 static char **interfaces;
-static size_t interfaces_num = 0;
+static size_t interfaces_num;
 
 static c_avl_tree_t *value_map;
 
index 26c7da32343ac81e01842b8fe2db39dc436fdce8..ef1a1387b0e7409e4b4453d7839a61034f5e2127 100644 (file)
@@ -61,7 +61,7 @@ struct fc_directory_conf_s {
 typedef struct fc_directory_conf_s fc_directory_conf_t;
 
 static fc_directory_conf_t **directories;
-static size_t directories_num = 0;
+static size_t directories_num;
 
 static void fc_free_dir(fc_directory_conf_t *dir) {
   sfree(dir->path);
index 6ed4115da8e241b6f91e0a4686133baa4fab00df..ca654194f6d277c9bacc4c2c758aefcd65dca018 100644 (file)
@@ -89,14 +89,14 @@ static char *mc_receive_group;
 static char *mc_receive_port;
 
 static struct pollfd *mc_receive_sockets;
-static size_t mc_receive_sockets_num = 0;
+static size_t mc_receive_sockets_num;
 
 static socket_entry_t *mc_send_sockets;
-static size_t mc_send_sockets_num = 0;
+static size_t mc_send_sockets_num;
 static pthread_mutex_t mc_send_sockets_lock = PTHREAD_MUTEX_INITIALIZER;
 
-static int mc_receive_thread_loop = 0;
-static int mc_receive_thread_running = 0;
+static int mc_receive_thread_loop;
+static int mc_receive_thread_running;
 static pthread_t mc_receive_thread_id;
 
 static metric_map_t metric_map_default[] =
@@ -123,7 +123,7 @@ static metric_map_t metric_map_default[] =
 static size_t metric_map_len_default = STATIC_ARRAY_SIZE(metric_map_default);
 
 static metric_map_t *metric_map;
-static size_t metric_map_len = 0;
+static size_t metric_map_len;
 
 static c_avl_tree_t *staging_tree;
 static pthread_mutex_t staging_lock = PTHREAD_MUTEX_INITIALIZER;
index 40609658ce82541ebeec898d2303b2501aa23e99..86110b0c4bfedcd307d84c26188265124893a745 100644 (file)
@@ -97,7 +97,7 @@ static bool report_inactive = true;
 #define MAX_NUMIF 256
 extern kstat_ctl_t *kc;
 static kstat_t *ksp[MAX_NUMIF];
-static int numif = 0;
+static int numif;
 static bool unique_name;
 #endif /* HAVE_LIBKSTAT */
 
index c1f42d73aec4d842ea548f64472a7cc7144e73d9..8fad588e85120c9bf78d86e0ccf29b3b3ec6092b 100644 (file)
@@ -87,7 +87,7 @@ typedef struct {
 } ip_chain_t;
 
 static ip_chain_t **chain_list;
-static int chain_num = 0;
+static int chain_num;
 
 static int iptables_config(const char *key, const char *value) {
   /* int ip_value; */
index 56b48df2633f155fc0a61826a25fe3a67ba188c6..449e816fb52703cfb1d4df43763634988497aad9 100644 (file)
@@ -82,7 +82,7 @@ static pthread_key_t jvm_env_key;
 
 /* Configuration options for the JVM. */
 static char **jvm_argv;
-static size_t jvm_argc = 0;
+static size_t jvm_argc;
 
 /* List of class names to load */
 static java_plugin_class_t *java_classes_list;
@@ -90,7 +90,7 @@ static size_t java_classes_list_len;
 
 /* List of config, init, and shutdown callbacks. */
 static cjni_callback_info_t *java_callbacks;
-static size_t java_callbacks_num = 0;
+static size_t java_callbacks_num;
 static pthread_mutex_t java_callbacks_lock = PTHREAD_MUTEX_INITIALIZER;
 
 static oconfig_item_t *config_block;
index 373dd2b7ecf666ccf6a7d10534b1faa96cd1211c..5a1ee8d0bcdce22f075716ada82fe92809b6fbfb 100644 (file)
@@ -156,7 +156,7 @@ static bool have_gcrypt(void) /* {{{ */
 #ifndef HAVE_HTONLL
 static uint64_t htonll(uint64_t val) /* {{{ */
 {
-  static int config = 0;
+  static int config;
 
   uint32_t hi;
   uint32_t lo;
@@ -186,7 +186,7 @@ static uint64_t htonll(uint64_t val) /* {{{ */
 
 static double htond(double val) /* {{{ */
 {
-  static int config = 0;
+  static int config;
 
   union {
     uint8_t byte[8];
index 91fe18de1a5a5f37164c28d7bfc1d2331fffc961..34ea21941192e440cd5bb90b6ee601760db8793c 100644 (file)
@@ -221,7 +221,7 @@ static int parse_time(uint16_t type, void *payload, size_t payload_size,
 
 static double ntohd(double val) /* {{{ */
 {
-  static int config = 0;
+  static int config;
 
   union {
     uint8_t byte[8];
index 2b7fbaebdbdd11d677b262137d3863aabdc15783..fa56a1bcc95e790d5aac21d4aa42394fc5548835 100644 (file)
@@ -41,7 +41,7 @@ static pthread_mutex_t file_lock = PTHREAD_MUTEX_INITIALIZER;
 
 static char *log_file;
 static int print_timestamp = 1;
-static int print_severity = 0;
+static int print_severity;
 
 static const char *config_keys[] = {"LogLevel", "File", "Timestamp",
                                     "PrintSeverity"};
index 9d1db55f37ff0ded4b5db339e88e04e2be1d2ed8..60ac3c8cb05959837875f78461c40dc26bdd11e3 100644 (file)
@@ -350,7 +350,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 static ignorelist_t *ignorelist;
 
 static int use_sysfs = 1;
-static int init_state = 0;
+static int init_state;
 
 static inline int item_watched(int i) {
   assert(i >= 0);
index 0c4ace6600b0821be1d35d20a33542febe77d492..4f4a9bacea13cfc2bf2fa86b802f548d386d8162 100644 (file)
--- a/src/mic.c
+++ b/src/mic.c
@@ -35,7 +35,7 @@
 #define MAX_CORES 256
 
 static MicDeviceOnSystem mics[MAX_MICS];
-static U32 num_mics = 0;
+static U32 num_mics;
 static HANDLE mic_handle;
 
 static int const therm_ids[] = {
index 9e56827a45a6b4b05bff544fa4899c2ed1bdefb1..48c34edc036897e7853599bfc6b0a6e197be2419 100644 (file)
@@ -89,7 +89,7 @@ struct mqtt_client_conf {
 typedef struct mqtt_client_conf mqtt_client_conf_t;
 
 static mqtt_client_conf_t **subscribers;
-static size_t subscribers_num = 0;
+static size_t subscribers_num;
 
 /*
  * Functions
index e99e38bc64e190f99f83ff127fbe3cc2ef608c17..045854793ed5a81ba03f82f3b12c6fa9262fe3b5 100644 (file)
@@ -97,7 +97,7 @@ static ir_ignorelist_t *ir_ignorelist_head;
 static struct mnl_socket *nl;
 
 static char **iflist;
-static size_t iflist_len = 0;
+static size_t iflist_len;
 
 static const char *config_keys[] = {"Interface", "VerboseInterface",
                                     "QDisc",     "Class",
index abed5b8771bc333f4fc44391f227fc4e81a6bc74..84ba00b58219d0d6a971844860fd5b343e709690 100644 (file)
@@ -261,7 +261,7 @@ typedef struct receive_list_entry_s receive_list_entry_t;
 /*
  * Private variables
  */
-static int network_config_ttl = 0;
+static int network_config_ttl;
 /* Ethernet - (IPv6 + UDP) = 1500 - (40 + 8) = 1452 */
 static size_t network_config_packet_size = 1452;
 static bool network_config_forward;
@@ -273,18 +273,18 @@ static receive_list_entry_t *receive_list_head;
 static receive_list_entry_t *receive_list_tail;
 static pthread_mutex_t receive_list_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t receive_list_cond = PTHREAD_COND_INITIALIZER;
-static uint64_t receive_list_length = 0;
+static uint64_t receive_list_length;
 
 static sockent_t *listen_sockets;
 static struct pollfd *listen_sockets_pollfd;
-static size_t listen_sockets_num = 0;
+static size_t listen_sockets_num;
 
 /* The receive and dispatch threads will run as long as `listen_loop' is set to
  * zero. */
-static int listen_loop = 0;
-static int receive_thread_running = 0;
+static int listen_loop;
+static int receive_thread_running;
 static pthread_t receive_thread_id;
-static int dispatch_thread_running = 0;
+static int dispatch_thread_running;
 static pthread_t dispatch_thread_id;
 
 /* Buffer in which to-be-sent network packets are constructed. */
@@ -301,14 +301,14 @@ static pthread_mutex_t send_buffer_lock = PTHREAD_MUTEX_INITIALIZER;
  * example). Only if neither is true, the stats_lock is acquired. The counters
  * are always read without holding a lock in the hope that writing 8 bytes to
  * memory is an atomic operation. */
-static derive_t stats_octets_rx = 0;
-static derive_t stats_octets_tx = 0;
-static derive_t stats_packets_rx = 0;
-static derive_t stats_packets_tx = 0;
-static derive_t stats_values_dispatched = 0;
-static derive_t stats_values_not_dispatched = 0;
-static derive_t stats_values_sent = 0;
-static derive_t stats_values_not_sent = 0;
+static derive_t stats_octets_rx;
+static derive_t stats_octets_tx;
+static derive_t stats_packets_rx;
+static derive_t stats_packets_tx;
+static derive_t stats_values_dispatched;
+static derive_t stats_values_not_dispatched;
+static derive_t stats_values_sent;
+static derive_t stats_values_not_sent;
 static pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER;
 
 /*
@@ -1113,7 +1113,7 @@ static int parse_part_sign_sha256(sockent_t *se, /* {{{ */
 static int parse_part_sign_sha256(sockent_t *se, /* {{{ */
                                   void **ret_buffer, size_t *ret_buffer_size,
                                   int flags) {
-  static int warning_has_been_printed = 0;
+  static int warning_has_been_printed;
 
   char *buffer;
   size_t buffer_size;
@@ -1268,7 +1268,7 @@ static int parse_part_encr_aes256(sockent_t *se, /* {{{ */
 static int parse_part_encr_aes256(sockent_t *se, /* {{{ */
                                   void **ret_buffer, size_t *ret_buffer_size,
                                   int flags) {
-  static int warning_has_been_printed = 0;
+  static int warning_has_been_printed;
 
   char *buffer;
   size_t buffer_size;
index e031cb70a8fb60c626285367d6ad5b2ab638f63e..e1987f1fc5db4fca16e30b5168d7f6bbd57ce46a 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
@@ -409,7 +409,7 @@ static int nfs_submit_fields_safe(int nfs_version, const char *instance,
 
 static int nfs_submit_nfs4_server(const char *instance, char **fields,
                                   size_t fields_num) {
-  static int suppress_warning = 0;
+  static int suppress_warning;
   size_t proc4x_names_num;
 
   switch (fields_num) {
@@ -451,7 +451,7 @@ static int nfs_submit_nfs4_client(const char *instance, char **fields,
                                   size_t fields_num) {
   size_t proc40_names_num, proc4x_names_num;
 
-  static int suppress_warning = 0;
+  static int suppress_warning;
 
   switch (fields_num) {
   case 34:
index 23feb1cdbb284a1339c930bee58b621de7065e50..e5ca89c06227e41f8970376cede0fb6c819efde6 100644 (file)
@@ -44,7 +44,7 @@ static char *timeout;
 static CURL *curl;
 
 static char nginx_buffer[16384];
-static size_t nginx_buffer_len = 0;
+static size_t nginx_buffer_len;
 static char nginx_curl_error[CURL_ERROR_SIZE];
 
 static const char *config_keys[] = {
index eb9ec00c1dab97ad88f6dd1f9a486071ede4c577..6b32ad9a4f21f25aa4236a20a75699fa7058afdc 100644 (file)
@@ -38,7 +38,7 @@ static const char *config_keys[] = {"SMTPServer",   "SMTPPort", "SMTPUser",
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
 static char **recipients;
-static int recipients_len = 0;
+static int recipients_len;
 
 static smtp_session_t session;
 static pthread_mutex_t session_lock = PTHREAD_MUTEX_INITIALIZER;
index a51c4c0b9cb0e9120e121559c57322af698eaeda..1d1e94b521cc9fdd02a19e58e828ba2c182d3795 100644 (file)
--- a/src/nut.c
+++ b/src/nut.c
@@ -53,8 +53,8 @@ struct nut_ups_s {
 static const char *config_keys[] = {"UPS", "FORCESSL", "VERIFYPEER", "CAPATH",
                                     "CONNECTTIMEOUT"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static int force_ssl = 0;   // Initialized to default of 0 (false)
-static int verify_peer = 0; // Initialized to default of 0 (false)
+static int force_ssl;   // Initialized to default of 0 (false)
+static int verify_peer; // Initialized to default of 0 (false)
 static int ssl_flags = UPSCLI_CONN_TRYSSL;
 static int connect_timeout = -1;
 static char *ca_path;
index b1d4cbe11143ea37e5ba662e19f925ae6c9e26ce..49c6aa3779d091eee7ff016a66a8d4f40ef2d678 100644 (file)
@@ -87,7 +87,7 @@ static ow_family_features_t ow_family_features[] = {
 static int ow_family_features_num = STATIC_ARRAY_SIZE(ow_family_features);
 
 static char *device_g;
-static cdtime_t ow_interval = 0;
+static cdtime_t ow_interval;
 static bool direct_access;
 
 static const char *config_keys[] = {"Device", "IgnoreSelected", "Sensor",
index 9c4b929dd31b252f631fc7fe302b0a6d1dec44fe..c76bce2011c2a677a6eeaa17b49b122a29c45d84 100644 (file)
@@ -76,9 +76,9 @@ typedef struct o_database_s o_database_t;
  * Global variables
  */
 static udb_query_t **queries;
-static size_t queries_num = 0;
+static size_t queries_num;
 static o_database_t **databases;
-static size_t databases_num = 0;
+static size_t databases_num;
 
 OCIEnv *oci_env = NULL;
 OCIError *oci_error = NULL;
index d760b4179430796002dab545892aafc723df98f6..4c6387dab2897cb14b1dc9ebe7ec001933ef9f6b 100644 (file)
@@ -192,7 +192,7 @@ static c_ithread_list_t *perl_threads;
 /* the key used to store each pthread's ithread */
 static pthread_key_t perl_thr_key;
 
-static int perl_argc = 0;
+static int perl_argc;
 static char **perl_argv;
 
 static char base_name[DATA_MAX_NAME_LEN] = "";
index a323b45b00891746d222ce83e1bd064fe5a89253..66b9cd1f0bc49ab5397fd357fc4e6d8fbdc14ed2 100644 (file)
@@ -100,7 +100,7 @@ typedef struct pinba_statnode_s pinba_statnode_t;
  */
 /* {{{ */
 static pinba_statnode_t *stat_nodes;
-static unsigned int stat_nodes_num = 0;
+static unsigned int stat_nodes_num;
 static pthread_mutex_t stat_nodes_lock;
 
 static char *conf_node;
index f89c830cf9aeb2c68c7dce150e8e121280761005..ffb16910eaff3655d7326e30592595dc1da31410 100644 (file)
@@ -84,8 +84,8 @@ static int ping_max_missed = -1;
 
 static pthread_mutex_t ping_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t ping_cond = PTHREAD_COND_INITIALIZER;
-static int ping_thread_loop = 0;
-static int ping_thread_error = 0;
+static int ping_thread_loop;
+static int ping_thread_error;
 static pthread_t ping_thread_id;
 
 static const char *config_keys[] = {"Host",    "SourceAddress", "AddressFamily",
index 9adba7d28c6065c8c8630d91c60e3a9bf14dd9c4..7c140e0a3d7967b918c8f38b380b47ea13a8fb22 100644 (file)
@@ -156,13 +156,13 @@ static const char *const def_queries[] = {
 static int def_queries_num = STATIC_ARRAY_SIZE(def_queries);
 
 static c_psql_database_t **databases;
-static size_t databases_num = 0;
+static size_t databases_num;
 
 static udb_query_t **queries;
-static size_t queries_num = 0;
+static size_t queries_num;
 
 static c_psql_writer_t *writers;
-static size_t writers_num = 0;
+static size_t writers_num;
 
 static int c_psql_begin(c_psql_database_t *db) {
   PGresult *r = PQexec(db->conn, "BEGIN");
@@ -1237,7 +1237,7 @@ static int c_psql_config_database(oconfig_item_t *ci) {
 } /* c_psql_config_database */
 
 static int c_psql_config(oconfig_item_t *ci) {
-  static int have_def_config = 0;
+  static int have_def_config;
 
   if (0 == have_def_config) {
     oconfig_item_t *c;
index 969a4db8d826ed2cdeb9617071936e66ef7ed7a9..64db6985ad4fa301663058c935794c9c73ba8a3a 100644 (file)
@@ -257,8 +257,8 @@ static cpy_callback_t *cpy_init_callbacks;
 static cpy_callback_t *cpy_shutdown_callbacks;
 
 /* Make sure to hold the GIL while modifying these. */
-static int cpy_shutdown_triggered = 0;
-static int cpy_num_callbacks = 0;
+static int cpy_shutdown_triggered;
+static int cpy_num_callbacks;
 
 static void cpy_destroy_user_data(void *data) {
   cpy_callback_t *c = data;
index c93e9fcef26237a9c2cc4eb7790e7ef285de2fd2..5c87a4346046b11d1a6f6c48a728ffe20051b0b0 100644 (file)
@@ -67,7 +67,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
  * is zero a default, depending on the `interval' member of the value list is
  * being used. */
 static char *datadir;
-static double write_rate = 0.0;
+static double write_rate;
 static rrdcreate_config_t rrdcreate_config = {
     /* stepsize = */ 0,
     /* heartbeat = */ 0,
@@ -84,9 +84,9 @@ static rrdcreate_config_t rrdcreate_config = {
 
 /* XXX: If you need to lock both, cache_lock and queue_lock, at the same time,
  * ALWAYS lock `cache_lock' first! */
-static cdtime_t cache_timeout = 0;
-static cdtime_t cache_flush_timeout = 0;
-static cdtime_t random_timeout = 0;
+static cdtime_t cache_timeout;
+static cdtime_t cache_flush_timeout;
+static cdtime_t random_timeout;
 static cdtime_t cache_flush_last;
 static c_avl_tree_t *cache;
 static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -104,7 +104,7 @@ static pthread_cond_t queue_cond = PTHREAD_COND_INITIALIZER;
 static pthread_mutex_t librrd_lock = PTHREAD_MUTEX_INITIALIZER;
 #endif
 
-static int do_shutdown = 0;
+static int do_shutdown;
 
 #if HAVE_THREADSAFE_LIBRRD
 static int srrd_update(char *filename, char *template, int argc,
@@ -1010,7 +1010,7 @@ static int rrd_shutdown(void) {
 } /* int rrd_shutdown */
 
 static int rrd_init(void) {
-  static int init_once = 0;
+  static int init_once;
 
   if (init_once != 0)
     return 0;
index 47db4e334581b912644a53d480fac0795a323cdb..41cccf1b6b686b6278e0d2b5cd7cd02b579db892 100644 (file)
@@ -251,7 +251,7 @@ static void sensors_free_features(void) {
 }
 
 static int sensors_load_conf(void) {
-  static int call_once = 0;
+  static int call_once;
 
   FILE *fh = NULL;
   featurelist_t *last_feature = NULL;
index 9f84955b06f2822e6aad1ea61d328aa71c2e08b5..62cbb4f1ef821ff730e07932ef9b883c083767f8 100644 (file)
@@ -43,8 +43,8 @@ static const char *config_keys[] = {"Disk", "IgnoreSelected", "IgnoreSleepMode",
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
 static ignorelist_t *ignorelist;
-static int ignore_sleep_mode = 0;
-static int use_serial = 0;
+static int ignore_sleep_mode;
+static int use_serial;
 
 static int smart_config(const char *key, const char *value) {
   if (ignorelist == NULL)
index b616f677fb1c5930e7e28488e41bad3c1c69ad46..433f5f86a66d5899137db2e65ffe36661527db19 100644 (file)
@@ -219,7 +219,7 @@ static void csnmp_host_definition_destroy(void *arg) /* {{{ */
  *      +-> csnmp_config_add_host_security_level
  */
 static void call_snmp_init_once(void) {
-  static int have_init = 0;
+  static int have_init;
 
   if (have_init == 0)
     init_snmp(PACKAGE_NAME);
index 90a97fb52fff8a27598332f60ac3a2525e945086..beb82456b40649c0b15fc0d5327b73787fc6655c 100644 (file)
@@ -38,7 +38,7 @@ static int log_level = LOG_DEBUG;
 #else
 static int log_level = LOG_INFO;
 #endif /* COLLECT_DEBUG */
-static int notif_severity = 0;
+static int notif_severity;
 
 static const char *config_keys[] = {
     "LogLevel", "NotifyLevel",
index 3d52380ab350e4cb782cc0ebd9371710ca9706be..a6471d832572e7074dde0865e76a943391598f7f 100644 (file)
@@ -60,7 +60,7 @@ struct ctail_config_match_s {
 typedef struct ctail_config_match_s ctail_config_match_t;
 
 static cu_tail_match_t **tail_match_list;
-static size_t tail_match_list_num = 0;
+static size_t tail_match_list_num;
 static cdtime_t tail_match_list_intervals[255];
 
 static int ctail_config_add_match_dstype(ctail_config_match_t *cm,
index f59b7ea6b3860dc3892269b4455e398f31943323..26bd969ac83c1c03b8060df1ed6cb7fa86009d3d 100644 (file)
@@ -36,7 +36,7 @@
 #define MAX_NUMTAPE 256
 extern kstat_ctl_t *kc;
 static kstat_t *ksp[MAX_NUMTAPE];
-static int numtape = 0;
+static int numtape;
 
 static int tape_init(void) {
   kstat_t *ksp_chain;
index 07170d788821314399fd3b0b4a2efcd49003252d..90dedce4dfe488bed5c7f37a60129690c725a5c3 100644 (file)
@@ -205,7 +205,7 @@ static const char *tcp_state[] = {"CLOSED",    "LISTEN",      "SYN_SENT",
                                   "FIN_WAIT2", "TIME_WAIT"};
 
 static kvm_t *kvmd;
-static u_long inpcbtable_off = 0;
+static u_long inpcbtable_off;
 struct inpcbtable *inpcbtable_ptr = NULL;
 
 #define TCP_STATE_LISTEN 1
@@ -261,8 +261,8 @@ static const char *config_keys[] = {"ListeningPorts", "LocalPort", "RemotePort",
                                     "AllPortsSummary"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
-static int port_collect_listening = 0;
-static int port_collect_total = 0;
+static int port_collect_listening;
+static int port_collect_total;
 static port_entry_t *port_list_head;
 static uint32_t count_total[TCP_STATE_MAX + 1];
 
@@ -271,7 +271,7 @@ static uint32_t count_total[TCP_STATE_MAX + 1];
 /* This depends on linux inet_diag_req because if this structure is missing,
  * sequence_number is useless and we get a compilation warning.
  */
-static uint32_t sequence_number = 0;
+static uint32_t sequence_number;
 #endif
 
 static enum { SRC_DUNNO, SRC_NETLINK, SRC_PROC } linux_source = SRC_DUNNO;
index 21d6357b16744fae13849fab05d2103ada747891..b5fa4c1ece7c86ed9e59583ec481d3c905d0fb4e 100644 (file)
--- a/src/ted.c
+++ b/src/ted.c
@@ -54,7 +54,7 @@
 #define DEFAULT_DEVICE "/dev/ttyUSB0"
 
 static char *conf_device;
-static int conf_retries = 0;
+static int conf_retries;
 
 static int fd = -1;
 
index 41e2e81e16b75e5a93e196095302491eb5e636b9..5cf69559210726c84a6d69c61c9aa9dbf3c5b468 100644 (file)
@@ -29,8 +29,8 @@
 
 #include <inttypes.h>
 
-static int fail_count__ = 0;
-static int check_count__ = 0;
+static int fail_count__;
+static int check_count__;
 
 #ifndef DBL_PRECISION
 #define DBL_PRECISION 1e-12
index be2af755c61c65c8a0ebffb8cd34c01631e484b3..522271c6627e52913d454b656dbaf6d983bf229c 100644 (file)
@@ -55,7 +55,7 @@ static const char *config_keys[] = {"SocketFile", "SocketGroup", "SocketPerms",
                                     "DeleteSocket"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
-static int loop = 0;
+static int loop;
 
 /* socket configuration */
 static int sock_fd = -1;
@@ -361,7 +361,7 @@ static int us_config(const char *key, const char *val) {
 } /* int us_config */
 
 static int us_init(void) {
-  static int have_init = 0;
+  static int have_init;
 
   int status;
 
index faa917f84396f3c6036ff2b98d9e3182bde9d2de..7b20e139c4cb0ac862f52b96608d56100834cab5 100644 (file)
@@ -166,8 +166,8 @@ static ip_list_t *IgnoreList;
 #if HAVE_PCAP_H
 static void (*Callback)(const rfc1035_header_t *);
 
-static int query_count_intvl = 0;
-static int query_count_total = 0;
+static int query_count_intvl;
+static int query_count_total;
 #ifdef __OpenBSD__
 static struct bpf_timeval last_ts;
 #else
@@ -267,7 +267,7 @@ static int rfc1035NameUnpack(const char *buf, size_t sz, off_t *off, char *name,
   off_t no = 0;
   unsigned char c;
   size_t len;
-  static int loop_detect = 0;
+  static int loop_detect;
   if (loop_detect > 2)
     return 4; /* compression loop */
   if (ns == 0)
index 57629a01a15f13771280d5a4873999783c6974b0..3b7236cadc4642a2c4d4e0f128eed4e234f7bb0f 100644 (file)
@@ -191,7 +191,7 @@ struct ovs_db_s {
 };
 
 /* Global variables */
-static uint64_t ovs_uid = 0;
+static uint64_t ovs_uid;
 static pthread_mutex_t ovs_uid_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 /* Post an event to event thread.
index cdb71418c419c322cf02536cb0b4e8091fa7b9df..12008f820f6a1332def85aac8074f3096edd8278 100644 (file)
@@ -241,7 +241,7 @@ const char *domain_reasons[][DOMAIN_STATE_REASON_MAX_SIZE] = {
   } while (0)
 
 /* Connection. */
-static virConnectPtr conn = 0;
+static virConnectPtr conn;
 static char *conn_string;
 static c_complain_t conn_complain = C_COMPLAIN_INIT_STATIC;
 
index 95cfbaf1ebed1d580787d73f3e3e90d640a70013..c7229756032b7837ca6d0275594e55d346e23885 100644 (file)
@@ -33,7 +33,7 @@
 static const char *config_keys[] = {"Verbose"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
-static int verbose_output = 0;
+static int verbose_output;
 /* #endif KERNEL_LINUX */
 
 #else
index f15bb3b5694ce7b6394eda40b69016392344ff04..3c6d58cd867011355939005cbae0b9affc3cc274 100644 (file)
@@ -42,7 +42,7 @@
 #error "No applicable input method."
 #endif
 
-static int pagesize = 0;
+static int pagesize;
 
 static int vserver_init(void) {
   /* XXX Should we check for getpagesize () in configure?
index a422f37227e00f3bb58a4b40e12def7b2fc4ec42..42f5d65b66e0439a7d20b20d6d833bf40d528dbb 100644 (file)
@@ -94,8 +94,8 @@ struct wt_callback {
   cdtime_t next_random_ttl;
 };
 
-static cdtime_t resolve_interval = 0;
-static cdtime_t resolve_jitter = 0;
+static cdtime_t resolve_interval;
+static cdtime_t resolve_jitter;
 
 /*
  * Functions