From a396da422740caf336a6d594515e8d80de6f440a Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Mon, 14 May 2018 12:48:25 +0200 Subject: [PATCH] Don't initialize static pointers to NULL This is the default --- src/aggregation.c | 4 ++-- src/amqp.c | 2 +- src/apcups.c | 4 ++-- src/aquaero.c | 2 +- src/ascent.c | 18 +++++++++--------- src/barometer.c | 10 +++++----- src/bind.c | 8 ++++---- src/ceph.c | 2 +- src/cgroups.c | 2 +- src/collectd-nagios.c | 8 ++++---- src/collectd-tg.c | 2 +- src/collectdmon.c | 2 +- src/cpu.c | 2 +- src/csv.c | 2 +- src/curl.c | 3 +-- src/daemon/configfile.c | 4 ++-- src/daemon/plugin.c | 14 +++++++------- src/daemon/utils_cache.c | 2 +- src/dbi.c | 4 ++-- src/df.c | 6 +++--- src/disk.c | 4 ++-- src/dns.c | 2 +- src/email.c | 6 +++--- src/ethstat.c | 4 ++-- src/exec.c | 2 +- src/filecount.c | 2 +- src/gmond.c | 10 +++++----- src/hddtemp.c | 2 +- src/intel_rdt.c | 2 +- src/interface.c | 2 +- src/ipmi.c | 4 ++-- src/iptables.c | 2 +- src/irq.c | 2 +- src/java.c | 10 +++++----- src/log_logstash.c | 2 +- src/logfile.c | 2 +- src/madwifi.c | 4 ++-- src/mbmon.c | 4 ++-- src/md.c | 2 +- src/memcachec.c | 4 ++-- src/mic.c | 6 +++--- src/modbus.c | 2 +- src/mqtt.c | 2 +- src/netlink.c | 4 ++-- src/network.c | 10 +++++----- src/nginx.c | 18 +++++++++--------- src/notify_email.c | 12 ++++++------ src/ntpd.c | 2 +- src/nut.c | 2 +- src/olsrd.c | 4 ++-- src/onewire.c | 4 ++-- src/oracle.c | 4 ++-- src/perl.c | 4 ++-- src/pinba.c | 6 +++--- src/ping.c | 8 ++++---- src/postgresql.c | 6 +++--- src/powerdns.c | 4 ++-- src/processes.c | 4 ++-- src/protocols.c | 2 +- src/pyconfig.c | 2 +- src/pyvalues.c | 13 +++++-------- src/redis.c | 2 +- src/rrdcached.c | 4 ++-- src/rrdtool.c | 12 ++++++------ src/sensors.c | 4 ++-- src/smart.c | 2 +- src/snmp.c | 2 +- src/snmp_agent.c | 2 +- src/statsd.c | 8 ++++---- src/swap.c | 2 +- src/tail.c | 11 +++++------ src/tail_csv.c | 2 +- src/tcpconns.c | 2 +- src/teamspeak2.c | 10 +++++----- src/ted.c | 2 +- src/tokyotyrant.c | 6 +++--- src/unixsock.c | 4 ++-- src/utils_dns.c | 6 +++--- src/utils_rrdcreate.c | 2 +- src/uuid.c | 2 +- src/virt.c | 8 ++++---- src/write_sensu.c | 4 ++-- src/zookeeper.c | 4 ++-- 83 files changed, 194 insertions(+), 199 deletions(-) diff --git a/src/aggregation.c b/src/aggregation.c index 7d35d41f..a8021996 100644 --- a/src/aggregation.c +++ b/src/aggregation.c @@ -83,10 +83,10 @@ struct agg_instance_s /* {{{ */ agg_instance_t *next; }; /* }}} */ -static lookup_t *lookup = NULL; +static lookup_t *lookup; static pthread_mutex_t agg_instance_list_lock = PTHREAD_MUTEX_INITIALIZER; -static agg_instance_t *agg_instance_list_head = NULL; +static agg_instance_t *agg_instance_list_head; static bool agg_is_regex(char const *str) /* {{{ */ { diff --git a/src/amqp.c b/src/amqp.c index 15579233..7a91ba11 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -111,7 +111,7 @@ static const char *def_user = "guest"; static const char *def_password = "guest"; static const char *def_exchange = "amq.fanout"; -static pthread_t *subscriber_threads = NULL; +static pthread_t *subscriber_threads; static size_t subscriber_threads_num = 0; static bool subscriber_threads_running = true; diff --git a/src/apcups.c b/src/apcups.c index 4b3f7b5c..4e84ebd2 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -70,8 +70,8 @@ typedef struct { * Private variables */ /* Default values for contacting daemon */ -static char *conf_node = NULL; -static char *conf_service = NULL; +static char *conf_node; +static char *conf_service; /* Defaults to false for backwards compatibility. */ static bool conf_report_seconds; static bool conf_persistent_conn = true; diff --git a/src/aquaero.c b/src/aquaero.c index beffc1a1..937742b0 100644 --- a/src/aquaero.c +++ b/src/aquaero.c @@ -30,7 +30,7 @@ * Private variables */ /* Default values for contacting daemon */ -static char *conf_device = NULL; +static char *conf_device; static int aquaero_config(oconfig_item_t *ci) { for (int i = 0; i < ci->children_num; i++) { diff --git a/src/ascent.c b/src/ascent.c index 36694f61..09dd5de7 100644 --- a/src/ascent.c +++ b/src/ascent.c @@ -87,17 +87,17 @@ typedef struct player_info_s player_info_t; #define PLAYER_INFO_STATIC_INIT \ { -1, -1, -1, -1, -1 } -static char *url = NULL; -static char *user = NULL; -static char *pass = NULL; -static char *verify_peer = NULL; -static char *verify_host = NULL; -static char *cacert = NULL; -static char *timeout = NULL; +static char *url; +static char *user; +static char *pass; +static char *verify_peer; +static char *verify_host; +static char *cacert; +static char *timeout; -static CURL *curl = NULL; +static CURL *curl; -static char *ascent_buffer = NULL; +static char *ascent_buffer; static size_t ascent_buffer_size = 0; static size_t ascent_buffer_fill = 0; static char ascent_curl_error[CURL_ERROR_SIZE]; diff --git a/src/barometer.c b/src/barometer.c index e55e3b8c..17c2a1a2 100644 --- a/src/barometer.c +++ b/src/barometer.c @@ -177,8 +177,8 @@ static const char *config_keys[] = { static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static char *config_device = NULL; /**< I2C bus device */ -static int config_oversample = 1; /**< averaging window */ +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 */ @@ -235,8 +235,8 @@ typedef struct averaging_s { int ring_buffer_head; } averaging_t; -static averaging_t pressure_averaging = {NULL, 0, 0L, 0}; -static averaging_t temperature_averaging = {NULL, 0, 0L, 0}; +static averaging_t pressure_averaging; +static averaging_t temperature_averaging; /** * Create / allocate averaging buffer @@ -317,7 +317,7 @@ typedef struct temperature_list_s { struct temperature_list_s *next; /**< next in the list */ } temperature_list_t; -static temperature_list_t *temp_list = NULL; +static temperature_list_t *temp_list; /* * Add new sensor to the temperature reference list diff --git a/src/bind.c b/src/bind.c index cc5aa593..2d10aba8 100644 --- a/src/bind.c +++ b/src/bind.c @@ -106,7 +106,7 @@ typedef struct list_info_ptr_s list_info_ptr_t; /* TODO: Remove time parsing code. */ static bool config_parse_time = true; -static char *url = NULL; +static char *url; static int global_opcodes = 1; static int global_qtypes = 1; static int global_server_stats = 1; @@ -115,12 +115,12 @@ static int global_resolver_stats = 0; static int global_memory_stats = 1; static int timeout = -1; -static cb_view_t *views = NULL; +static cb_view_t *views; static size_t views_num = 0; -static CURL *curl = NULL; +static CURL *curl; -static char *bind_buffer = NULL; +static char *bind_buffer; static size_t bind_buffer_size = 0; static size_t bind_buffer_fill = 0; static char bind_curl_error[CURL_ERROR_SIZE]; diff --git a/src/ceph.c b/src/ceph.c index 804514ca..e2c98ed0 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -161,7 +161,7 @@ static int long_run_latency_avg = 0; static int convert_special_metrics = 1; /** Array of daemons to monitor */ -static struct ceph_daemon **g_daemons = NULL; +static struct ceph_daemon **g_daemons; /** Number of elements in g_daemons */ static size_t g_num_daemons = 0; diff --git a/src/cgroups.c b/src/cgroups.c index 5830c7ba..7f24d12e 100644 --- a/src/cgroups.c +++ b/src/cgroups.c @@ -31,7 +31,7 @@ static char const *config_keys[] = {"CGroup", "IgnoreSelected"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *il_cgroup = NULL; +static ignorelist_t *il_cgroup; __attribute__((nonnull(1))) __attribute__((nonnull(2))) static void cgroups_submit_one(char const *plugin_instance, char const *type_instance, diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c index 2c9bf4a7..68ed437c 100644 --- a/src/collectd-nagios.c +++ b/src/collectd-nagios.c @@ -94,16 +94,16 @@ typedef struct range_s range_t; extern char *optarg; extern int optind, opterr, optopt; -static char *socket_file_g = NULL; -static char *value_string_g = NULL; -static char *hostname_g = NULL; +static char *socket_file_g; +static char *value_string_g; +static char *hostname_g; static range_t range_critical_g; static range_t range_warning_g; static int consolitation_g = CON_NONE; static bool nan_is_error_g; -static char **match_ds_g = NULL; +static char **match_ds_g; static size_t match_ds_num_g = 0; /* `strdup' is an XSI extension. I don't want to pull in all of XSI just for diff --git a/src/collectd-tg.c b/src/collectd-tg.c index 64547b80..9357ce3d 100644 --- a/src/collectd-tg.c +++ b/src/collectd-tg.c @@ -62,7 +62,7 @@ static const char *conf_service = NET_DEFAULT_PORT; static lcc_network_t *net; -static c_heap_t *values_heap = NULL; +static c_heap_t *values_heap; static struct sigaction sigint_action; static struct sigaction sigterm_action; diff --git a/src/collectdmon.c b/src/collectdmon.c index 4a7d1a6b..6c198895 100644 --- a/src/collectdmon.c +++ b/src/collectdmon.c @@ -74,7 +74,7 @@ static int loop = 0; static int restart = 0; -static const char *pidfile = NULL; +static const char *pidfile; static pid_t collectd_pid = 0; __attribute__((noreturn)) static void exit_usage(const char *name) { diff --git a/src/cpu.c b/src/cpu.c index 5a32b6b2..7478a4ab 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -187,7 +187,7 @@ struct cpu_state_s { }; typedef struct cpu_state_s cpu_state_t; -static cpu_state_t *cpu_states = NULL; +static cpu_state_t *cpu_states; static size_t cpu_states_num = 0; /* #cpu_states allocated */ /* Highest CPU number in the current iteration. Used by the dispatch logic to diff --git a/src/csv.c b/src/csv.c index f5126d26..34fc2238 100644 --- a/src/csv.c +++ b/src/csv.c @@ -33,7 +33,7 @@ static const char *config_keys[] = {"DataDir", "StoreRates"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static char *datadir = NULL; +static char *datadir; static int store_rates = 0; static int use_stdio = 0; diff --git a/src/curl.c b/src/curl.c index 769ba23a..4bfd1e4d 100644 --- a/src/curl.c +++ b/src/curl.c @@ -85,8 +85,7 @@ struct web_page_s /* {{{ */ /* * Global variables; */ -/* static CURLM *curl = NULL; */ -static web_page_t *pages_g = NULL; +static web_page_t *pages_g; /* * Private functions diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index e8d1092a..2830a86e 100644 --- a/src/daemon/configfile.c +++ b/src/daemon/configfile.c @@ -91,8 +91,8 @@ static int dispatch_block_plugin(oconfig_item_t *ci); /* * Private variables */ -static cf_callback_t *first_callback = NULL; -static cf_complex_callback_t *complex_callback_head = NULL; +static cf_callback_t *first_callback; +static cf_complex_callback_t *complex_callback_head; static cf_value_map_t cf_value_map[] = {{"TypesDB", dispatch_value_typesdb}, {"PluginDir", dispatch_value_plugindir}, diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c index 734e8a0a..5374d8d2 100644 --- a/src/daemon/plugin.c +++ b/src/daemon/plugin.c @@ -94,7 +94,7 @@ typedef struct flush_callback_s flush_callback_t; /* * Private variables */ -static c_avl_tree_t *plugins_loaded = NULL; +static c_avl_tree_t *plugins_loaded; static llist_t *list_init; static llist_t *list_write; @@ -104,22 +104,22 @@ static llist_t *list_shutdown; static llist_t *list_log; static llist_t *list_notification; -static fc_chain_t *pre_cache_chain = NULL; -static fc_chain_t *post_cache_chain = NULL; +static fc_chain_t *pre_cache_chain; +static fc_chain_t *post_cache_chain; static c_avl_tree_t *data_sets; -static char *plugindir = NULL; +static char *plugindir; #ifndef DEFAULT_MAX_READ_INTERVAL #define DEFAULT_MAX_READ_INTERVAL TIME_T_TO_CDTIME_T_STATIC(86400) #endif -static c_heap_t *read_heap = NULL; +static c_heap_t *read_heap; static llist_t *read_list; 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 = NULL; +static pthread_t *read_threads; static size_t read_threads_num = 0; static cdtime_t max_read_interval = DEFAULT_MAX_READ_INTERVAL; @@ -129,7 +129,7 @@ static long write_queue_length = 0; 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_t *write_threads; static size_t write_threads_num = 0; static pthread_key_t plugin_ctx_key; diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index 8e28a5d8..610c11e5 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -76,7 +76,7 @@ struct uc_iter_s { cache_entry_t *entry; }; -static c_avl_tree_t *cache_tree = NULL; +static c_avl_tree_t *cache_tree; static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER; static int cache_compare(const cache_entry_t *a, const cache_entry_t *b) { diff --git a/src/dbi.c b/src/dbi.c index 5f8520f3..dcc32e68 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -85,9 +85,9 @@ typedef struct cdbi_database_s cdbi_database_t; /* }}} */ #if !defined(HAVE_LEGACY_LIBDBI) || !HAVE_LEGACY_LIBDBI static dbi_inst dbi_instance = 0; #endif -static udb_query_t **queries = NULL; +static udb_query_t **queries; static size_t queries_num = 0; -static cdbi_database_t **databases = NULL; +static cdbi_database_t **databases; static size_t databases_num = 0; static int cdbi_read_database(user_data_t *ud); diff --git a/src/df.c b/src/df.c index 3cade6a2..e3aa4536 100644 --- a/src/df.c +++ b/src/df.c @@ -51,9 +51,9 @@ static const char *config_keys[] = { "ReportByDevice", "ReportInodes", "ValuesAbsolute", "ValuesPercentage"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *il_device = NULL; -static ignorelist_t *il_mountpoint = NULL; -static ignorelist_t *il_fstype = NULL; +static ignorelist_t *il_device; +static ignorelist_t *il_mountpoint; +static ignorelist_t *il_fstype; static bool by_device; static bool report_inodes; diff --git a/src/disk.c b/src/disk.c index 962b7c30..7b5c0249 100644 --- a/src/disk.c +++ b/src/disk.c @@ -145,7 +145,7 @@ static int pnumdisk; #if HAVE_LIBUDEV_H #include -static char *conf_udev_name_attr = NULL; +static char *conf_udev_name_attr; static struct udev *handle_udev; #endif @@ -153,7 +153,7 @@ static const char *config_keys[] = {"Disk", "UseBSDName", "IgnoreSelected", "UdevNameAttr"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *ignorelist = NULL; +static ignorelist_t *ignorelist; static int disk_config(const char *key, const char *value) { if (ignorelist == NULL) diff --git a/src/dns.c b/src/dns.c index 3ab456b5..ef627eb8 100644 --- a/src/dns.c +++ b/src/dns.c @@ -57,7 +57,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); static int select_numeric_qtype = 1; #define PCAP_SNAPLEN 1460 -static char *pcap_device = NULL; +static char *pcap_device; static derive_t tr_queries; static derive_t tr_responses; diff --git a/src/email.c b/src/email.c index d94c542f..4f49cfb3 100644 --- a/src/email.c +++ b/src/email.c @@ -111,8 +111,8 @@ static const char *config_keys[] = {"SocketFile", "SocketGroup", "SocketPerms", static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); /* socket configuration */ -static char *sock_file = NULL; -static char *sock_group = NULL; +static char *sock_file; +static char *sock_group; static int sock_perms = S_IRWXU | S_IRWXG; static int max_conns = MAX_CONNS; @@ -134,7 +134,7 @@ static conn_list_t conns; static pthread_cond_t collector_available = PTHREAD_COND_INITIALIZER; /* collector threads */ -static collector_t **collectors = NULL; +static collector_t **collectors; static pthread_mutex_t available_mutex = PTHREAD_MUTEX_INITIALIZER; static int available_collectors; diff --git a/src/ethstat.c b/src/ethstat.c index 316c25fc..371020c9 100644 --- a/src/ethstat.c +++ b/src/ethstat.c @@ -48,10 +48,10 @@ struct value_map_s { }; typedef struct value_map_s value_map_t; -static char **interfaces = NULL; +static char **interfaces; static size_t interfaces_num = 0; -static c_avl_tree_t *value_map = NULL; +static c_avl_tree_t *value_map; static bool collect_mapped_only; diff --git a/src/exec.c b/src/exec.c index 36f2d4da..b145e813 100644 --- a/src/exec.c +++ b/src/exec.c @@ -80,7 +80,7 @@ typedef struct program_list_and_notification_s { /* * Private variables */ -static program_list_t *pl_head = NULL; +static program_list_t *pl_head; static pthread_mutex_t pl_lock = PTHREAD_MUTEX_INITIALIZER; /* diff --git a/src/filecount.c b/src/filecount.c index 67308f41..26c7da32 100644 --- a/src/filecount.c +++ b/src/filecount.c @@ -60,7 +60,7 @@ struct fc_directory_conf_s { }; typedef struct fc_directory_conf_s fc_directory_conf_t; -static fc_directory_conf_t **directories = NULL; +static fc_directory_conf_t **directories; static size_t directories_num = 0; static void fc_free_dir(fc_directory_conf_t *dir) { diff --git a/src/gmond.c b/src/gmond.c index cb005fd9..6ed4115d 100644 --- a/src/gmond.c +++ b/src/gmond.c @@ -84,14 +84,14 @@ struct metric_map_s { typedef struct metric_map_s metric_map_t; #define MC_RECEIVE_GROUP_DEFAULT "239.2.11.71" -static char *mc_receive_group = NULL; +static char *mc_receive_group; #define MC_RECEIVE_PORT_DEFAULT "8649" -static char *mc_receive_port = NULL; +static char *mc_receive_port; -static struct pollfd *mc_receive_sockets = NULL; +static struct pollfd *mc_receive_sockets; static size_t mc_receive_sockets_num = 0; -static socket_entry_t *mc_send_sockets = NULL; +static socket_entry_t *mc_send_sockets; static size_t mc_send_sockets_num = 0; static pthread_mutex_t mc_send_sockets_lock = PTHREAD_MUTEX_INITIALIZER; @@ -122,7 +122,7 @@ static metric_map_t metric_map_default[] = {"pkts_out", "if_packets", "", "tx", -1, -1}}; static size_t metric_map_len_default = STATIC_ARRAY_SIZE(metric_map_default); -static metric_map_t *metric_map = NULL; +static metric_map_t *metric_map; static size_t metric_map_len = 0; static c_avl_tree_t *staging_tree; diff --git a/src/hddtemp.c b/src/hddtemp.c index 36c41289..80daf15b 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -53,7 +53,7 @@ static const char *config_keys[] = {"Host", "Port"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static char *hddtemp_host = NULL; +static char *hddtemp_host; static char hddtemp_port[16]; /* diff --git a/src/intel_rdt.c b/src/intel_rdt.c index 29c02fe5..3d4c9889 100644 --- a/src/intel_rdt.c +++ b/src/intel_rdt.c @@ -59,7 +59,7 @@ struct rdt_ctx_s { }; typedef struct rdt_ctx_s rdt_ctx_t; -static rdt_ctx_t *g_rdt = NULL; +static rdt_ctx_t *g_rdt; static rdt_config_status g_state = UNKNOWN; diff --git a/src/interface.c b/src/interface.c index 3e2b2cd5..40609658 100644 --- a/src/interface.c +++ b/src/interface.c @@ -86,7 +86,7 @@ static const char *config_keys[] = { }; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *ignorelist = NULL; +static ignorelist_t *ignorelist; static bool report_inactive = true; diff --git a/src/ipmi.c b/src/ipmi.c index 2475278a..7f628bfd 100644 --- a/src/ipmi.c +++ b/src/ipmi.c @@ -95,8 +95,8 @@ typedef struct c_ipmi_db_type_map_s c_ipmi_db_type_map_t; /* * Module global variables */ -static os_handler_t *os_handler = NULL; -static c_ipmi_instance_t *instances = NULL; +static os_handler_t *os_handler; +static c_ipmi_instance_t *instances; /* * Misc private functions diff --git a/src/iptables.c b/src/iptables.c index bc75d7bc..c1f42d73 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -86,7 +86,7 @@ typedef struct { char name[64]; } ip_chain_t; -static ip_chain_t **chain_list = NULL; +static ip_chain_t **chain_list; static int chain_num = 0; static int iptables_config(const char *key, const char *value) { diff --git a/src/irq.c b/src/irq.c index f8cf37ca..aa6ac04b 100644 --- a/src/irq.c +++ b/src/irq.c @@ -37,7 +37,7 @@ static const char *config_keys[] = {"Irq", "IgnoreSelected"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *ignorelist = NULL; +static ignorelist_t *ignorelist; /* * Private functions diff --git a/src/java.c b/src/java.c index a35ca46c..56b48df2 100644 --- a/src/java.c +++ b/src/java.c @@ -77,23 +77,23 @@ typedef struct cjni_callback_info_s cjni_callback_info_t; /* * Global variables */ -static JavaVM *jvm = NULL; +static JavaVM *jvm; static pthread_key_t jvm_env_key; /* Configuration options for the JVM. */ -static char **jvm_argv = NULL; +static char **jvm_argv; static size_t jvm_argc = 0; /* List of class names to load */ -static java_plugin_class_t *java_classes_list = NULL; +static java_plugin_class_t *java_classes_list; static size_t java_classes_list_len; /* List of config, init, and shutdown callbacks. */ -static cjni_callback_info_t *java_callbacks = NULL; +static cjni_callback_info_t *java_callbacks; static size_t java_callbacks_num = 0; static pthread_mutex_t java_callbacks_lock = PTHREAD_MUTEX_INITIALIZER; -static oconfig_item_t *config_block = NULL; +static oconfig_item_t *config_block; /* * Prototypes diff --git a/src/log_logstash.c b/src/log_logstash.c index 2553a28c..8f3063f3 100644 --- a/src/log_logstash.c +++ b/src/log_logstash.c @@ -49,7 +49,7 @@ static int log_level = LOG_INFO; static pthread_mutex_t file_lock = PTHREAD_MUTEX_INITIALIZER; -static char *log_file = NULL; +static char *log_file; static const char *config_keys[] = {"LogLevel", "File"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); diff --git a/src/logfile.c b/src/logfile.c index ee2ed5ce..2b7fbaeb 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -39,7 +39,7 @@ static int log_level = LOG_INFO; static pthread_mutex_t file_lock = PTHREAD_MUTEX_INITIALIZER; -static char *log_file = NULL; +static char *log_file; static int print_timestamp = 1; static int print_severity = 0; diff --git a/src/madwifi.c b/src/madwifi.c index 1a387b78..9d1db55f 100644 --- a/src/madwifi.c +++ b/src/madwifi.c @@ -99,8 +99,8 @@ #error "No applicable input method." #endif -#include #include "madwifi.h" +#include struct stat_spec { uint16_t flags; @@ -347,7 +347,7 @@ static const char *config_keys[] = {"Interface", "IgnoreSelected", "Source", "MiscAdd", "MiscRemove", "MiscSet"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *ignorelist = NULL; +static ignorelist_t *ignorelist; static int use_sysfs = 1; static int init_state = 0; diff --git a/src/mbmon.c b/src/mbmon.c index f58d01ec..63a300de 100644 --- a/src/mbmon.c +++ b/src/mbmon.c @@ -38,8 +38,8 @@ static const char *config_keys[] = {"Host", "Port", NULL}; static int config_keys_num = 2; -static char *mbmon_host = NULL; -static char *mbmon_port = NULL; +static char *mbmon_host; +static char *mbmon_port; /* * NAME diff --git a/src/md.c b/src/md.c index b8df328e..0a015c7b 100644 --- a/src/md.c +++ b/src/md.c @@ -40,7 +40,7 @@ static const char *config_keys[] = {"Device", "IgnoreSelected"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *ignorelist = NULL; +static ignorelist_t *ignorelist; static int md_config(const char *key, const char *value) { if (ignorelist == NULL) diff --git a/src/memcachec.c b/src/memcachec.c index bd088ecd..13e388e8 100644 --- a/src/memcachec.c +++ b/src/memcachec.c @@ -68,7 +68,7 @@ struct web_page_s /* {{{ */ /* * Global variables; */ -static web_page_t *pages_g = NULL; +static web_page_t *pages_g; /* * Private functions @@ -412,7 +412,7 @@ static void cmc_submit(const web_page_t *wp, const web_match_t *wm, /* {{{ */ vl.values = &value; vl.values_len = 1; sstrncpy(vl.plugin, (wp->plugin_name != NULL) ? wp->plugin_name : "memcachec", - sizeof (vl.plugin)); + sizeof(vl.plugin)); sstrncpy(vl.plugin_instance, wp->instance, sizeof(vl.plugin_instance)); sstrncpy(vl.type, wm->type, sizeof(vl.type)); sstrncpy(vl.type_instance, wm->instance, sizeof(vl.type_instance)); diff --git a/src/mic.c b/src/mic.c index b65679e7..0c4ace66 100644 --- a/src/mic.c +++ b/src/mic.c @@ -36,7 +36,7 @@ static MicDeviceOnSystem mics[MAX_MICS]; static U32 num_mics = 0; -static HANDLE mic_handle = NULL; +static HANDLE mic_handle; static int const therm_ids[] = { eMicThermalDie, eMicThermalDevMem, eMicThermalFin, eMicThermalFout, @@ -54,9 +54,9 @@ 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; static bool show_power = true; -static ignorelist_t *power_ignore = NULL; +static ignorelist_t *power_ignore; static int mic_init(void) { U32 ret; diff --git a/src/modbus.c b/src/modbus.c index 2b5e6877..efcf6be8 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -152,7 +152,7 @@ struct mb_data_group_s /* {{{ */ /* * Global variables */ -static mb_data_t *data_definitions = NULL; +static mb_data_t *data_definitions; /* * Functions diff --git a/src/mqtt.c b/src/mqtt.c index 3d89f407..9e56827a 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -88,7 +88,7 @@ struct mqtt_client_conf { }; typedef struct mqtt_client_conf mqtt_client_conf_t; -static mqtt_client_conf_t **subscribers = NULL; +static mqtt_client_conf_t **subscribers; static size_t subscribers_num = 0; /* diff --git a/src/netlink.c b/src/netlink.c index 67fbe551..e99e38bc 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -92,11 +92,11 @@ struct qos_stats { }; static int ir_ignorelist_invert = 1; -static ir_ignorelist_t *ir_ignorelist_head = NULL; +static ir_ignorelist_t *ir_ignorelist_head; static struct mnl_socket *nl; -static char **iflist = NULL; +static char **iflist; static size_t iflist_len = 0; static const char *config_keys[] = {"Interface", "VerboseInterface", diff --git a/src/network.c b/src/network.c index ab5ff299..abed5b87 100644 --- a/src/network.c +++ b/src/network.c @@ -267,16 +267,16 @@ static size_t network_config_packet_size = 1452; static bool network_config_forward; static bool network_config_stats; -static sockent_t *sending_sockets = NULL; +static sockent_t *sending_sockets; -static receive_list_entry_t *receive_list_head = NULL; -static receive_list_entry_t *receive_list_tail = NULL; +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 sockent_t *listen_sockets = NULL; -static struct pollfd *listen_sockets_pollfd = NULL; +static sockent_t *listen_sockets; +static struct pollfd *listen_sockets_pollfd; static size_t listen_sockets_num = 0; /* The receive and dispatch threads will run as long as `listen_loop' is set to diff --git a/src/nginx.c b/src/nginx.c index 88118b9b..23feb1cd 100644 --- a/src/nginx.c +++ b/src/nginx.c @@ -33,15 +33,15 @@ #include -static char *url = NULL; -static char *user = NULL; -static char *pass = NULL; -static char *verify_peer = NULL; -static char *verify_host = NULL; -static char *cacert = NULL; -static char *timeout = NULL; - -static CURL *curl = NULL; +static char *url; +static char *user; +static char *pass; +static char *verify_peer; +static char *verify_host; +static char *cacert; +static char *timeout; + +static CURL *curl; static char nginx_buffer[16384]; static size_t nginx_buffer_len = 0; diff --git a/src/notify_email.c b/src/notify_email.c index 52cc8384..eb9ec00c 100644 --- a/src/notify_email.c +++ b/src/notify_email.c @@ -43,14 +43,14 @@ static int recipients_len = 0; static smtp_session_t session; static pthread_mutex_t session_lock = PTHREAD_MUTEX_INITIALIZER; static smtp_message_t message; -static auth_context_t authctx = NULL; +static auth_context_t authctx; static int smtp_port = 25; -static char *smtp_host = NULL; -static char *smtp_user = NULL; -static char *smtp_password = NULL; -static char *email_from = NULL; -static char *email_subject = NULL; +static char *smtp_host; +static char *smtp_user; +static char *smtp_password; +static char *email_from; +static char *email_subject; #define DEFAULT_SMTP_HOST "localhost" #define DEFAULT_SMTP_FROM "root@localhost" diff --git a/src/ntpd.c b/src/ntpd.c index 8976866d..baa1988b 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -66,7 +66,7 @@ static bool include_unit_id; #define NTPD_DEFAULT_HOST "localhost" #define NTPD_DEFAULT_PORT "123" static int sock_descr = -1; -static char *ntpd_host = NULL; +static char *ntpd_host; static char ntpd_port[16]; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/src/nut.c b/src/nut.c index 58c7d797..a51c4c0b 100644 --- a/src/nut.c +++ b/src/nut.c @@ -57,7 +57,7 @@ static int force_ssl = 0; // Initialized to default of 0 (false) static int verify_peer = 0; // Initialized to default of 0 (false) static int ssl_flags = UPSCLI_CONN_TRYSSL; static int connect_timeout = -1; -static char *ca_path = NULL; +static char *ca_path; static int nut_read(user_data_t *user_data); diff --git a/src/olsrd.c b/src/olsrd.c index eb640771..df052889 100644 --- a/src/olsrd.c +++ b/src/olsrd.c @@ -41,8 +41,8 @@ static const char *config_keys[] = {"Host", "Port", "CollectLinks", "CollectRoutes", "CollectTopology"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static char *config_node = NULL; -static char *config_service = NULL; +static char *config_node; +static char *config_service; #define OLSRD_WANT_NOT 0 #define OLSRD_WANT_SUMMARY 1 diff --git a/src/onewire.c b/src/onewire.c index 37112ad7..b1d4cbe1 100644 --- a/src/onewire.c +++ b/src/onewire.c @@ -86,7 +86,7 @@ static ow_family_features_t ow_family_features[] = { /* features_num = */ 1}}; static int ow_family_features_num = STATIC_ARRAY_SIZE(ow_family_features); -static char *device_g = NULL; +static char *device_g; static cdtime_t ow_interval = 0; static bool direct_access; @@ -109,7 +109,7 @@ typedef struct direct_access_element_s { struct direct_access_element_s *next; /**< Next in the list */ } direct_access_element_t; -static direct_access_element_t *direct_list = NULL; +static direct_access_element_t *direct_list; /* =================================================================================== */ diff --git a/src/oracle.c b/src/oracle.c index bf6aef58..9c4b929d 100644 --- a/src/oracle.c +++ b/src/oracle.c @@ -75,9 +75,9 @@ typedef struct o_database_s o_database_t; /* * Global variables */ -static udb_query_t **queries = NULL; +static udb_query_t **queries; static size_t queries_num = 0; -static o_database_t **databases = NULL; +static o_database_t **databases; static size_t databases_num = 0; OCIEnv *oci_env = NULL; diff --git a/src/perl.c b/src/perl.c index 6683b4cc..d760b417 100644 --- a/src/perl.c +++ b/src/perl.c @@ -187,13 +187,13 @@ static bool register_legacy_flush = true; /* if perl_threads != NULL perl_threads->head must * point to the "base" thread */ -static c_ithread_list_t *perl_threads = NULL; +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 char **perl_argv = NULL; +static char **perl_argv; static char base_name[DATA_MAX_NAME_LEN] = ""; diff --git a/src/pinba.c b/src/pinba.c index e82ac0e5..a323b45b 100644 --- a/src/pinba.c +++ b/src/pinba.c @@ -99,12 +99,12 @@ typedef struct pinba_statnode_s pinba_statnode_t; * Module global variables */ /* {{{ */ -static pinba_statnode_t *stat_nodes = NULL; +static pinba_statnode_t *stat_nodes; static unsigned int stat_nodes_num = 0; static pthread_mutex_t stat_nodes_lock; -static char *conf_node = NULL; -static char *conf_service = NULL; +static char *conf_node; +static char *conf_service; static bool collector_thread_running; static bool collector_thread_do_shutdown; diff --git a/src/ping.c b/src/ping.c index 565ae99c..f89c830c 100644 --- a/src/ping.c +++ b/src/ping.c @@ -69,14 +69,14 @@ typedef struct hostlist_s hostlist_t; /* * Private variables */ -static hostlist_t *hostlist_head = NULL; +static hostlist_t *hostlist_head; static int ping_af = PING_DEF_AF; -static char *ping_source = NULL; +static char *ping_source; #ifdef HAVE_OPING_1_3 -static char *ping_device = NULL; +static char *ping_device; #endif -static char *ping_data = NULL; +static char *ping_data; static int ping_ttl = PING_DEF_TTL; static double ping_interval = 1.0; static double ping_timeout = 0.9; diff --git a/src/postgresql.c b/src/postgresql.c index f626b579..9adba7d2 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -155,13 +155,13 @@ static const char *const def_queries[] = { "table_states", "disk_io", "disk_usage"}; static int def_queries_num = STATIC_ARRAY_SIZE(def_queries); -static c_psql_database_t **databases = NULL; +static c_psql_database_t **databases; static size_t databases_num = 0; -static udb_query_t **queries = NULL; +static udb_query_t **queries; static size_t queries_num = 0; -static c_psql_writer_t *writers = NULL; +static c_psql_writer_t *writers; static size_t writers_num = 0; static int c_psql_begin(c_psql_database_t *db) { diff --git a/src/powerdns.c b/src/powerdns.c index 729a15b4..eb3ec537 100644 --- a/src/powerdns.c +++ b/src/powerdns.c @@ -304,10 +304,10 @@ static statname_lookup_t lookup_table[] = /* {{{ */ {"uptime", "uptime", NULL}}; /* }}} */ static int lookup_table_length = STATIC_ARRAY_SIZE(lookup_table); -static llist_t *list = NULL; +static llist_t *list; #define PDNS_LOCAL_SOCKPATH LOCALSTATEDIR "/run/" PACKAGE_NAME "-powerdns" -static char *local_sockpath = NULL; +static char *local_sockpath; /* TODO: Do this before 4.4: * - Update the collectd.conf(5) manpage. diff --git a/src/processes.c b/src/processes.c index 2a4ce1f7..cfc57900 100644 --- a/src/processes.c +++ b/src/processes.c @@ -293,7 +293,7 @@ typedef struct procstat { struct procstat_entry_s *instances; } procstat_t; -static procstat_t *list_head_g = NULL; +static procstat_t *list_head_g; static bool want_init = true; static bool report_ctx_switch; @@ -334,7 +334,7 @@ int getargs(void *processBuffer, int bufferLen, char *argsBuffer, int argsLen); #endif /* HAVE_PROCINFO_H */ #if HAVE_LIBTASKSTATS -static ts_t *taskstats_handle = NULL; +static ts_t *taskstats_handle; #endif /* put name of process from config to list_head_g tree diff --git a/src/protocols.c b/src/protocols.c index a50539ef..59eb49a7 100644 --- a/src/protocols.c +++ b/src/protocols.c @@ -45,7 +45,7 @@ static const char *config_keys[] = { }; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *values_list = NULL; +static ignorelist_t *values_list; /* * Functions diff --git a/src/pyconfig.c b/src/pyconfig.c index c6e89306..4ba7e0d2 100644 --- a/src/pyconfig.c +++ b/src/pyconfig.c @@ -129,7 +129,7 @@ static int Config_init(PyObject *s, PyObject *args, PyObject *kwds) { static PyObject *Config_repr(PyObject *s) { Config *self = (Config *)s; PyObject *ret = NULL; - static PyObject *node_prefix = NULL, *root_prefix = NULL, *ending = NULL; + static PyObject *node_prefix, *root_prefix, *ending; /* This is ok because we have the GIL, so this is thread-save by default. */ if (node_prefix == NULL) diff --git a/src/pyvalues.c b/src/pyvalues.c index 12c8dde8..301df442 100644 --- a/src/pyvalues.c +++ b/src/pyvalues.c @@ -52,9 +52,8 @@ typedef struct { static PyObject *cpy_common_repr(PyObject *s) { PyObject *ret, *tmp; - static PyObject *l_type = NULL, *l_type_instance = NULL, *l_plugin = NULL, - *l_plugin_instance = NULL; - static PyObject *l_host = NULL, *l_time = NULL; + static PyObject *l_type, *l_type_instance, *l_plugin, *l_plugin_instance; + static PyObject *l_host, *l_time; PluginData *self = (PluginData *)s; if (l_type == NULL) @@ -203,7 +202,7 @@ static int PluginData_init(PyObject *s, PyObject *args, PyObject *kwds) { static PyObject *PluginData_repr(PyObject *s) { PyObject *ret; - static PyObject *l_closing = NULL; + static PyObject *l_closing; if (l_closing == NULL) l_closing = cpy_string_to_unicode_or_bytes(")"); @@ -843,8 +842,7 @@ static PyObject *Values_write(Values *self, PyObject *args, PyObject *kwds) { static PyObject *Values_repr(PyObject *s) { PyObject *ret, *tmp; - static PyObject *l_interval = NULL, *l_values = NULL, *l_meta = NULL, - *l_closing = NULL; + static PyObject *l_interval, *l_values, *l_meta, *l_closing; Values *self = (Values *)s; if (l_interval == NULL) @@ -1146,8 +1144,7 @@ static int Notification_setstring(PyObject *self, PyObject *value, void *data) { static PyObject *Notification_repr(PyObject *s) { PyObject *ret, *tmp; - static PyObject *l_severity = NULL, *l_message = NULL, *l_meta = NULL, - *l_closing = NULL; + static PyObject *l_severity, *l_message, *l_meta, *l_closing; Notification *self = (Notification *)s; if (l_severity == NULL) diff --git a/src/redis.c b/src/redis.c index 7c704ab5..2d33e2dc 100644 --- a/src/redis.c +++ b/src/redis.c @@ -76,7 +76,7 @@ struct redis_node_s { redis_node_t *next; }; -static redis_node_t *nodes_head = NULL; +static redis_node_t *nodes_head; static int redis_node_add(const redis_node_t *rn) /* {{{ */ { diff --git a/src/rrdcached.c b/src/rrdcached.c index c09e0485..8b742bb5 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -37,8 +37,8 @@ /* * Private variables */ -static char *datadir = NULL; -static char *daemon_address = NULL; +static char *datadir; +static char *daemon_address; static bool config_create_files = true; static bool config_collect_stats = true; static rrdcreate_config_t rrdcreate_config = { diff --git a/src/rrdtool.c b/src/rrdtool.c index e3ad07e2..c93e9fce 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -66,7 +66,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); /* If datadir is zero, the daemon's basedir is used. If stepsize or heartbeat * is zero a default, depending on the `interval' member of the value list is * being used. */ -static char *datadir = NULL; +static char *datadir; static double write_rate = 0.0; static rrdcreate_config_t rrdcreate_config = { /* stepsize = */ 0, @@ -88,13 +88,13 @@ static cdtime_t cache_timeout = 0; static cdtime_t cache_flush_timeout = 0; static cdtime_t random_timeout = 0; static cdtime_t cache_flush_last; -static c_avl_tree_t *cache = NULL; +static c_avl_tree_t *cache; static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER; -static rrd_queue_t *queue_head = NULL; -static rrd_queue_t *queue_tail = NULL; -static rrd_queue_t *flushq_head = NULL; -static rrd_queue_t *flushq_tail = NULL; +static rrd_queue_t *queue_head; +static rrd_queue_t *queue_tail; +static rrd_queue_t *flushq_head; +static rrd_queue_t *flushq_tail; static pthread_t queue_thread; static int queue_thread_running = 1; static pthread_mutex_t queue_lock = PTHREAD_MUTEX_INITIALIZER; diff --git a/src/sensors.c b/src/sensors.c index ddd09d9b..47db4e33 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -157,7 +157,7 @@ typedef struct featurelist { struct featurelist *next; } featurelist_t; -static char *conffile = NULL; +static char *conffile; static bool use_labels; /* #endif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */ @@ -166,7 +166,7 @@ static bool use_labels; "as bug." #endif -static featurelist_t *first_feature = NULL; +static featurelist_t *first_feature; static ignorelist_t *sensor_list; #if SENSORS_API_VERSION < 0x400 diff --git a/src/smart.c b/src/smart.c index 30680be6..9f84955b 100644 --- a/src/smart.c +++ b/src/smart.c @@ -42,7 +42,7 @@ static const char *config_keys[] = {"Disk", "IgnoreSelected", "IgnoreSleepMode", static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *ignorelist = NULL; +static ignorelist_t *ignorelist; static int ignore_sleep_mode = 0; static int use_serial = 0; diff --git a/src/snmp.c b/src/snmp.c index 800c0505..b616f677 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -115,7 +115,7 @@ typedef struct csnmp_table_values_s csnmp_table_values_t; /* * Private variables */ -static data_definition_t *data_head = NULL; +static data_definition_t *data_head; /* * Prototypes diff --git a/src/snmp_agent.c b/src/snmp_agent.c index 0675a767..48d9f869 100644 --- a/src/snmp_agent.c +++ b/src/snmp_agent.c @@ -90,7 +90,7 @@ struct snmp_agent_ctx_s { }; typedef struct snmp_agent_ctx_s snmp_agent_ctx_t; -static snmp_agent_ctx_t *g_agent = NULL; +static snmp_agent_ctx_t *g_agent; #define CHECK_DD_TYPE(_dd, _p, _pi, _t, _ti) \ (_dd->plugin ? !strcmp(_dd->plugin, _p) : 0) && \ diff --git a/src/statsd.c b/src/statsd.c index c7b472f1..28ee337c 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -61,22 +61,22 @@ struct statsd_metric_s { }; typedef struct statsd_metric_s statsd_metric_t; -static c_avl_tree_t *metrics_tree = NULL; +static c_avl_tree_t *metrics_tree; static pthread_mutex_t metrics_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_t network_thread; static bool network_thread_running; static bool network_thread_shutdown; -static char *conf_node = NULL; -static char *conf_service = NULL; +static char *conf_node; +static char *conf_service; 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 double *conf_timer_percentile; static size_t conf_timer_percentile_num; static bool conf_counter_sum; diff --git a/src/swap.c b/src/swap.c index ede638a6..db0b987c 100644 --- a/src/swap.c +++ b/src/swap.c @@ -93,7 +93,7 @@ static bool report_by_device; /* #endif defined(VM_SWAPUSAGE) */ #elif HAVE_LIBKVM_GETSWAPINFO -static kvm_t *kvm_obj = NULL; +static kvm_t *kvm_obj; int kvm_pagesize; /* #endif HAVE_LIBKVM_GETSWAPINFO */ diff --git a/src/tail.c b/src/tail.c index fbba4788..3d52380a 100644 --- a/src/tail.c +++ b/src/tail.c @@ -59,7 +59,7 @@ struct ctail_config_match_s { }; typedef struct ctail_config_match_s ctail_config_match_t; -static cu_tail_match_t **tail_match_list = NULL; +static cu_tail_match_t **tail_match_list; static size_t tail_match_list_num = 0; static cdtime_t tail_match_list_intervals[255]; @@ -134,8 +134,7 @@ static int ctail_config_add_match_dstype(ctail_config_match_t *cm, return 0; } /* int ctail_config_add_match_dstype */ -static int ctail_config_add_match(cu_tail_match_t *tm, - const char *plugin_name, +static int ctail_config_add_match(cu_tail_match_t *tm, const char *plugin_name, const char *plugin_instance, oconfig_item_t *ci, cdtime_t interval) { ctail_config_match_t cm = {0}; @@ -194,8 +193,8 @@ static int ctail_config_add_match(cu_tail_match_t *tm, // TODO(octo): there's nothing "simple" about the latency stuff … status = tail_match_add_match_simple( tm, cm.regex, cm.excluderegex, cm.flags, - (plugin_name != NULL) ? plugin_name : "tail", plugin_instance, - cm.type, cm.type_instance, cm.latency, interval); + (plugin_name != NULL) ? plugin_name : "tail", plugin_instance, cm.type, + cm.type_instance, cm.latency, interval); if (status != 0) ERROR("tail plugin: tail_match_add_match_simple failed."); @@ -234,7 +233,7 @@ static int ctail_config_add_file(oconfig_item_t *ci) { int status = 0; if (strcasecmp("Plugin", option->key) == 0) - status = cf_util_get_string (option, &plugin_name); + status = cf_util_get_string(option, &plugin_name); else if (strcasecmp("Instance", option->key) == 0) status = cf_util_get_string(option, &plugin_instance); else if (strcasecmp("Interval", option->key) == 0) diff --git a/src/tail_csv.c b/src/tail_csv.c index ff967052..be7cd40f 100644 --- a/src/tail_csv.c +++ b/src/tail_csv.c @@ -57,7 +57,7 @@ struct instance_definition_s { typedef struct instance_definition_s instance_definition_t; /* Private */ -static metric_definition_t *metric_head = NULL; +static metric_definition_t *metric_head; static int tcsv_submit(instance_definition_t *id, metric_definition_t *md, value_t v, cdtime_t t) { diff --git a/src/tcpconns.c b/src/tcpconns.c index 50d8efbf..07170d78 100644 --- a/src/tcpconns.c +++ b/src/tcpconns.c @@ -263,7 +263,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); static int port_collect_listening = 0; static int port_collect_total = 0; -static port_entry_t *port_list_head = NULL; +static port_entry_t *port_list_head; static uint32_t count_total[TCP_STATE_MAX + 1]; #if KERNEL_LINUX diff --git a/src/teamspeak2.c b/src/teamspeak2.c index ae9200c1..6d0cdbb8 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -46,14 +46,14 @@ typedef struct vserver_list_s { int port; struct vserver_list_s *next; } vserver_list_t; -static vserver_list_t *server_list = NULL; +static vserver_list_t *server_list; /* Host data */ -static char *config_host = NULL; -static char *config_port = NULL; +static char *config_host; +static char *config_port; -static FILE *global_read_fh = NULL; -static FILE *global_write_fh = NULL; +static FILE *global_read_fh; +static FILE *global_write_fh; /* Config data */ static const char *config_keys[] = {"Host", "Port", "Server"}; diff --git a/src/ted.c b/src/ted.c index b8036810..21d6357b 100644 --- a/src/ted.c +++ b/src/ted.c @@ -53,7 +53,7 @@ #define DEFAULT_DEVICE "/dev/ttyUSB0" -static char *conf_device = NULL; +static char *conf_device; static int conf_retries = 0; static int fd = -1; diff --git a/src/tokyotyrant.c b/src/tokyotyrant.c index 1534f51e..aca0a4e3 100644 --- a/src/tokyotyrant.c +++ b/src/tokyotyrant.c @@ -33,10 +33,10 @@ static const char *config_keys[] = {"Host", "Port"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static char *config_host = NULL; -static char *config_port = NULL; +static char *config_host; +static char *config_port; -static TCRDB *rdb = NULL; +static TCRDB *rdb; static int tt_config(const char *key, const char *value) { if (strcasecmp("Host", key) == 0) { diff --git a/src/unixsock.c b/src/unixsock.c index be80a3a2..be2af755 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -59,8 +59,8 @@ static int loop = 0; /* socket configuration */ static int sock_fd = -1; -static char *sock_file = NULL; -static char *sock_group = NULL; +static char *sock_file; +static char *sock_group; static int sock_perms = S_IRWXU | S_IRWXG; static bool delete_socket; diff --git a/src/utils_dns.c b/src/utils_dns.c index e7e04f7c..faa917f8 100644 --- a/src/utils_dns.c +++ b/src/utils_dns.c @@ -158,13 +158,13 @@ typedef int(printer)(const char *, ...); */ #if HAVE_PCAP_H -static pcap_t *pcap_obj = NULL; +static pcap_t *pcap_obj; #endif -static ip_list_t *IgnoreList = NULL; +static ip_list_t *IgnoreList; #if HAVE_PCAP_H -static void (*Callback)(const rfc1035_header_t *) = NULL; +static void (*Callback)(const rfc1035_header_t *); static int query_count_intvl = 0; static int query_count_total = 0; diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c index ef126012..ce7838d5 100644 --- a/src/utils_rrdcreate.c +++ b/src/utils_rrdcreate.c @@ -61,7 +61,7 @@ static int rra_types_num = STATIC_ARRAY_SIZE(rra_types); static pthread_mutex_t librrd_lock = PTHREAD_MUTEX_INITIALIZER; #endif -static async_create_file_t *async_creation_list = NULL; +static async_create_file_t *async_creation_list; static pthread_mutex_t async_creation_lock = PTHREAD_MUTEX_INITIALIZER; /* diff --git a/src/uuid.c b/src/uuid.c index 1cb90270..39b1fe6f 100644 --- a/src/uuid.c +++ b/src/uuid.c @@ -37,7 +37,7 @@ #define UUID_PRINTABLE_COMPACT_LENGTH (UUID_RAW_LENGTH * 2) #define UUID_PRINTABLE_NORMAL_LENGTH (UUID_PRINTABLE_COMPACT_LENGTH + 4) -static char *uuidfile = NULL; +static char *uuidfile; static const char *config_keys[] = {"UUIDFile"}; diff --git a/src/virt.c b/src/virt.c index 69a35a7f..cdb71418 100644 --- a/src/virt.c +++ b/src/virt.c @@ -242,7 +242,7 @@ const char *domain_reasons[][DOMAIN_STATE_REASON_MAX_SIZE] = { /* Connection. */ static virConnectPtr conn = 0; -static char *conn_string = NULL; +static char *conn_string; static c_complain_t conn_complain = C_COMPLAIN_INIT_STATIC; /* Node information required for %CPU */ @@ -252,11 +252,11 @@ static virNodeInfo nodeinfo; static int interval = 60; /* List of domains, if specified. */ -static ignorelist_t *il_domains = NULL; +static ignorelist_t *il_domains; /* List of block devices, if specified. */ -static ignorelist_t *il_block_devices = NULL; +static ignorelist_t *il_block_devices; /* List of network interface devices, if specified. */ -static ignorelist_t *il_interface_devices = NULL; +static ignorelist_t *il_interface_devices; static int ignore_device_match(ignorelist_t *, const char *domname, const char *devpath); diff --git a/src/write_sensu.c b/src/write_sensu.c index 99885a62..3b4a574d 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -119,8 +119,8 @@ struct sensu_host { int reference_count; }; -static char *sensu_tags = NULL; -static char **sensu_attrs = NULL; +static char *sensu_tags; +static char **sensu_attrs; static size_t sensu_attrs_num; static int add_str_to_list(struct str_list *strs, diff --git a/src/zookeeper.c b/src/zookeeper.c index 1de01d00..a99bbc01 100644 --- a/src/zookeeper.c +++ b/src/zookeeper.c @@ -37,8 +37,8 @@ #define ZOOKEEPER_DEF_HOST "127.0.0.1" #define ZOOKEEPER_DEF_PORT "2181" -static char *zk_host = NULL; -static char *zk_port = NULL; +static char *zk_host; +static char *zk_port; static const char *config_keys[] = {"Host", "Port"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -- 2.11.0