From 8361c1e963f9184c3c4d87197fd6996d667cdb3f Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sat, 2 Apr 2016 13:55:22 +0200 Subject: [PATCH] Treewide: cleanup whitespace --- src/apple_sensors.c | 2 +- src/battery.c | 2 +- src/bind.c | 10 ++--- src/collectd-tg.c | 2 +- src/cpython.h | 8 ++-- src/curl_xml.c | 24 +++++------ src/daemon/collectd.h | 2 +- src/daemon/configfile.c | 6 +-- src/daemon/configfile.h | 2 +- src/daemon/filter_chain.c | 2 +- src/daemon/filter_chain.h | 2 +- src/daemon/meta_data.c | 6 +-- src/daemon/utils_cache.c | 2 +- src/daemon/utils_heap.c | 2 +- src/daemon/utils_ignorelist.c | 2 +- src/daemon/utils_threshold.h | 2 +- src/daemon/utils_time.h | 2 +- src/dbi.c | 4 +- src/disk.c | 18 ++++---- src/drbd.c | 2 +- src/filecount.c | 4 +- src/gmond.c | 2 +- src/ipmi.c | 2 +- src/libcollectdclient/collectd/network.h | 2 +- src/liboconfig/oconfig.c | 2 +- src/madwifi.c | 14 +++--- src/match_regex.c | 2 +- src/match_value.c | 4 +- src/modbus.c | 4 +- src/mysql.c | 18 ++++---- src/netapp.c | 28 ++++++------ src/nfs.c | 22 +++++----- src/notify_email.c | 6 +-- src/olsrd.c | 6 +-- src/openldap.c | 2 +- src/oracle.c | 12 +++--- src/pinba.c | 50 ++++++++++----------- src/ping.c | 2 +- src/postgresql.c | 4 +- src/protocols.c | 2 +- src/pyconfig.c | 16 +++---- src/python.c | 58 ++++++++++++------------- src/pyvalues.c | 74 ++++++++++++++++---------------- src/rrdcached.c | 4 +- src/rrdtool.c | 8 ++-- src/sensors.c | 6 +-- src/teamspeak2.c | 22 +++++----- src/users.c | 6 +-- src/utils_db_query.h | 4 +- src/utils_dns.h | 4 +- src/utils_parse_option.c | 2 +- src/utils_vl_lookup.c | 12 +++--- src/utils_vl_lookup_test.c | 2 +- src/uuid.c | 2 +- src/vmem.c | 4 +- src/vserver.c | 6 +-- src/wireless.c | 4 +- 57 files changed, 262 insertions(+), 262 deletions(-) diff --git a/src/apple_sensors.c b/src/apple_sensors.c index 19d5a49f..7ed2016f 100644 --- a/src/apple_sensors.c +++ b/src/apple_sensors.c @@ -59,7 +59,7 @@ static mach_port_t io_master_port = MACH_PORT_NULL; static int as_init (void) { kern_return_t status; - + if (io_master_port != MACH_PORT_NULL) { mach_port_deallocate (mach_task_self (), diff --git a/src/battery.c b/src/battery.c index b87739ac..0350a9eb 100644 --- a/src/battery.c +++ b/src/battery.c @@ -341,7 +341,7 @@ static void get_via_generic_iokit (double *ret_capacity_full, /* {{{ */ *ret_voltage = temp_double / 1000.0; } } - + CFRelease (bat_root_dict); } diff --git a/src/bind.c b/src/bind.c index b9731eee..f2cd1677 100644 --- a/src/bind.c +++ b/src/bind.c @@ -54,7 +54,7 @@ # define BIND_DEFAULT_URL "http://localhost:8053/" #endif -/* +/* * Some types used for the callback functions. `translation_table_ptr_t' and * `list_info_ptr_t' are passed to the callbacks in the `void *user_data' * pointer. @@ -474,7 +474,7 @@ static int bind_xml_read_timestamp (const char *xpath_expression, /* {{{ */ return (0); } /* }}} int bind_xml_read_timestamp */ -/* +/* * bind_parse_generic_name_value * * Reads statistics in the form: @@ -559,7 +559,7 @@ static int bind_parse_generic_name_value (const char *xpath_expression, /* {{{ * return (0); } /* }}} int bind_parse_generic_name_value */ -/* +/* * bind_parse_generic_value_list * * Reads statistics in the form: @@ -774,7 +774,7 @@ static int bind_xml_stats_handle_zone (int version, xmlDoc *doc, /* {{{ */ { /* Parse the tag {{{ */ char plugin_instance[DATA_MAX_NAME_LEN]; translation_table_ptr_t table_ptr = - { + { nsstats_translation_table, nsstats_translation_table_length, plugin_instance @@ -955,7 +955,7 @@ static int bind_xml_stats_handle_view (int version, xmlDoc *doc, /* {{{ */ { char plugin_instance[DATA_MAX_NAME_LEN]; translation_table_ptr_t table_ptr = - { + { resstats_translation_table, resstats_translation_table_length, plugin_instance diff --git a/src/collectd-tg.c b/src/collectd-tg.c index 04989dce..23257fde 100644 --- a/src/collectd-tg.c +++ b/src/collectd-tg.c @@ -367,7 +367,7 @@ int main (int argc, char **argv) /* {{{ */ else { lcc_server_t *srv; - + srv = lcc_server_create (net, conf_destination, conf_service); if (srv == NULL) { diff --git a/src/cpython.h b/src/cpython.h index 81e580d4..880fa4ce 100644 --- a/src/cpython.h +++ b/src/cpython.h @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Sven Trenkel + * Sven Trenkel **/ /* Some python versions don't include this by default. */ @@ -111,10 +111,10 @@ } while (0) static inline void CPY_STRCAT(PyObject **a, PyObject *b) { PyObject *ret; - + if (!a || !*a) return; - + ret = PyUnicode_Concat(*a, b); Py_DECREF(*a); *a = ret; @@ -156,7 +156,7 @@ static inline PyObject *cpy_string_to_unicode_or_bytes(const char *buf) { return PyBytes_FromString(buf); #else return PyString_FromString(buf); -#endif +#endif } void cpy_log_exception(const char *context); diff --git a/src/curl_xml.c b/src/curl_xml.c index b9f0c24f..03ac0c13 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -248,7 +248,7 @@ static int cx_check_type (const data_set_t *ds, cx_xpath_t *xpath) /* {{{ */ return (0); } /* }}} cx_check_type */ -static xmlXPathObjectPtr cx_evaluate_xpath (xmlXPathContextPtr xpath_ctx, /* {{{ */ +static xmlXPathObjectPtr cx_evaluate_xpath (xmlXPathContextPtr xpath_ctx, /* {{{ */ xmlChar *expr) { xmlXPathObjectPtr xpath_obj; @@ -315,7 +315,7 @@ static int cx_handle_single_value_xpath (xmlXPathContextPtr xpath_ctx, /* {{{ */ { WARNING ("curl_xml plugin: " "relative xpath expression \"%s\" is expected to return " - "only text/attribute node which is not the case. Skipping...", + "only text/attribute node which is not the case. Skipping...", xpath->values[index].path); xmlXPathFreeObject (values_node_obj); return (-1); @@ -336,7 +336,7 @@ static int cx_handle_single_value_xpath (xmlXPathContextPtr xpath_ctx, /* {{{ */ vl->values[index].absolute = (absolute_t) strtoull (node_value, /* endptr = */ NULL, /* base = */ 0); break; - case DS_TYPE_GAUGE: + case DS_TYPE_GAUGE: vl->values[index].gauge = (gauge_t) strtod (node_value, /* endptr = */ NULL); } @@ -472,7 +472,7 @@ static int cx_handle_instance_xpath (xmlXPathContextPtr xpath_ctx, /* {{{ */ static int cx_handle_base_xpath (char const *plugin_instance, /* {{{ */ char const *host, - xmlXPathContextPtr xpath_ctx, const data_set_t *ds, + xmlXPathContextPtr xpath_ctx, const data_set_t *ds, char *base_xpath, cx_xpath_t *xpath) { int total_nodes; @@ -483,7 +483,7 @@ static int cx_handle_base_xpath (char const *plugin_instance, /* {{{ */ value_list_t vl = VALUE_LIST_INIT; - base_node_obj = cx_evaluate_xpath (xpath_ctx, BAD_CAST base_xpath); + base_node_obj = cx_evaluate_xpath (xpath_ctx, BAD_CAST base_xpath); if (base_node_obj == NULL) return -1; /* error is logged already */ @@ -500,7 +500,7 @@ static int cx_handle_base_xpath (char const *plugin_instance, /* {{{ */ } /* If base_xpath returned multiple results, then */ - /* Instance in the xpath block is required */ + /* Instance in the xpath block is required */ if (total_nodes > 1 && xpath->instance == NULL) { ERROR ("curl_xml plugin: " @@ -515,7 +515,7 @@ static int cx_handle_base_xpath (char const *plugin_instance, /* {{{ */ sstrncpy (vl.plugin, "curl_xml", sizeof (vl.plugin)); sstrncpy (vl.host, (host != NULL) ? host : hostname_g, sizeof (vl.host)); if (plugin_instance != NULL) - sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); + sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); for (i = 0; i < total_nodes; i++) { @@ -534,19 +534,19 @@ static int cx_handle_base_xpath (char const *plugin_instance, /* {{{ */ } /* for (i = 0; i < total_nodes; i++) */ /* free up the allocated memory */ - xmlXPathFreeObject (base_node_obj); + xmlXPathFreeObject (base_node_obj); - return (0); + return (0); } /* }}} cx_handle_base_xpath */ -static int cx_handle_parsed_xml(xmlDocPtr doc, /* {{{ */ +static int cx_handle_parsed_xml(xmlDocPtr doc, /* {{{ */ xmlXPathContextPtr xpath_ctx, cx_t *db) { llentry_t *le; const data_set_t *ds; cx_xpath_t *xpath; int status=-1; - + le = llist_head (db->list); while (le != NULL) @@ -620,7 +620,7 @@ static int cx_curl_perform (cx_t *db, CURL *curl) /* {{{ */ char *url; url = db->url; - db->buffer_fill = 0; + db->buffer_fill = 0; status = curl_easy_perform (curl); if (status != CURLE_OK) { diff --git a/src/daemon/collectd.h b/src/daemon/collectd.h index 66b48568..90021874 100644 --- a/src/daemon/collectd.h +++ b/src/daemon/collectd.h @@ -294,7 +294,7 @@ typedef int _Bool; # pragma GCC poison strcpy strcat strtok #endif -/* +/* * Special hack for the perl plugin: Because the later included perl.h defines * a macro which is never used, but contains `sprintf', we cannot poison that * identifies just yet. The parl plugin will do that itself once perl.h is diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index 78d4eea8..1d81a652 100644 --- a/src/daemon/configfile.c +++ b/src/daemon/configfile.c @@ -257,7 +257,7 @@ static int dispatch_value_typesdb (oconfig_item_t *ci) static int dispatch_value_plugindir (oconfig_item_t *ci) { assert (strcasecmp (ci->key, "PluginDir") == 0); - + if (ci->values_num != 1) return (-1); if (ci->values[0].type != OCONFIG_TYPE_STRING) @@ -924,7 +924,7 @@ static oconfig_item_t *cf_read_generic (const char *path, } /* oconfig_item_t *cf_read_generic */ #endif /* !HAVE_WORDEXP_H */ -/* +/* * Public functions */ int global_option_set (const char *option, const char *value) @@ -967,7 +967,7 @@ const char *global_option_get (const char *option) if (i >= cf_global_options_num) return (NULL); - + return ((cf_global_options[i].value != NULL) ? cf_global_options[i].value : cf_global_options[i].def); diff --git a/src/daemon/configfile.h b/src/daemon/configfile.h index 648246bd..09dbe58f 100644 --- a/src/daemon/configfile.h +++ b/src/daemon/configfile.h @@ -34,7 +34,7 @@ /* * DESCRIPTION * Remove a registered plugin from the internal data structures. - * + * * PARAMETERS * `type' Name of the plugin (must be the same as passed to * `plugin_register' diff --git a/src/daemon/filter_chain.c b/src/daemon/filter_chain.c index babf3996..f4e343c1 100644 --- a/src/daemon/filter_chain.c +++ b/src/daemon/filter_chain.c @@ -333,7 +333,7 @@ static int fc_config_add_target (fc_target_t **targets_head, /* {{{ */ { t->user_data = NULL; } - + if (*targets_head != NULL) { ptr = *targets_head; diff --git a/src/daemon/filter_chain.h b/src/daemon/filter_chain.h index 2db90dbb..dbf4b833 100644 --- a/src/daemon/filter_chain.h +++ b/src/daemon/filter_chain.h @@ -97,7 +97,7 @@ int fc_process_chain (const data_set_t *ds, value_list_t *vl, int fc_default_action (const data_set_t *ds, value_list_t *vl); -/* +/* * Shortcut for global configuration */ int fc_configure (const oconfig_item_t *ci); diff --git a/src/daemon/meta_data.c b/src/daemon/meta_data.c index cb8a195c..f87e35e4 100644 --- a/src/daemon/meta_data.c +++ b/src/daemon/meta_data.c @@ -314,7 +314,7 @@ int meta_data_toc (meta_data_t *md, char ***toc) /* {{{ */ pthread_mutex_lock (&md->lock); for (e = md->head; e != NULL; e = e->next) - ++count; + ++count; if (count == 0) { @@ -325,7 +325,7 @@ int meta_data_toc (meta_data_t *md, char ***toc) /* {{{ */ *toc = calloc(count, sizeof(**toc)); for (e = md->head; e != NULL; e = e->next) (*toc)[i++] = strdup(e->key); - + pthread_mutex_unlock (&md->lock); return count; } /* }}} int meta_data_toc */ @@ -504,7 +504,7 @@ int meta_data_get_string (meta_data_t *md, /* {{{ */ ERROR ("meta_data_get_string: md_strdup failed."); return (-ENOMEM); } - + pthread_mutex_unlock (&md->lock); *value = temp; diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index e1cfac98..b5b059c0 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -246,7 +246,7 @@ int uc_check_timeout (void) int status; int i; - + pthread_mutex_lock (&cache_lock); now = cdtime (); diff --git a/src/daemon/utils_heap.c b/src/daemon/utils_heap.c index ae502c90..19b1d5b9 100644 --- a/src/daemon/utils_heap.c +++ b/src/daemon/utils_heap.c @@ -173,7 +173,7 @@ int c_heap_insert (c_heap_t *h, void *ptr) /* Reorganize the heap from bottom up. */ reheap (h, /* parent of this node = */ (index - 1) / 2, DIR_UP); - + pthread_mutex_unlock (&h->lock); return (0); } /* int c_heap_insert */ diff --git a/src/daemon/utils_ignorelist.c b/src/daemon/utils_ignorelist.c index d867c848..79824a67 100644 --- a/src/daemon/utils_ignorelist.c +++ b/src/daemon/utils_ignorelist.c @@ -27,7 +27,7 @@ **/ /** * Usage: - * + * * Define plugin's global pointer variable of type ignorelist_t: * ignorelist_t *myconfig_ignore; * If you know the state of the global ignore (IgnoreSelected), diff --git a/src/daemon/utils_threshold.h b/src/daemon/utils_threshold.h index bf097fae..a5c33737 100644 --- a/src/daemon/utils_threshold.h +++ b/src/daemon/utils_threshold.h @@ -59,7 +59,7 @@ threshold_t *threshold_get (const char *hostname, threshold_t *threshold_search (const value_list_t *vl); -int ut_search_threshold (const value_list_t *vl, +int ut_search_threshold (const value_list_t *vl, threshold_t *ret_threshold); #endif /* UTILS_THRESHOLD_H */ diff --git a/src/daemon/utils_time.h b/src/daemon/utils_time.h index 46faa9ce..4d88dccb 100644 --- a/src/daemon/utils_time.h +++ b/src/daemon/utils_time.h @@ -43,7 +43,7 @@ extern cdtime_t cdtime_mock; * manner is that comparing times and calculating differences is as simple as * it is with "time_t", i.e. a simple integer comparison / subtraction works. */ -/* +/* * cdtime_t is defined in "collectd.h" */ /* typedef uint64_t cdtime_t; */ diff --git a/src/dbi.c b/src/dbi.c index 7dec51ad..655581e8 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -148,7 +148,7 @@ static int cdbi_result_get_field (dbi_result res, /* {{{ */ else if (src_type == DBI_TYPE_STRING) { const char *value; - + value = dbi_result_get_string_idx (res, index); if (value == NULL) sstrncpy (buffer, "", buffer_size); @@ -214,7 +214,7 @@ static void cdbi_database_free (cdbi_database_t *db) /* {{{ */ * * ... * - * + * * * Driver "mysql" * Interval 120 diff --git a/src/disk.c b/src/disk.c index b60fefa0..85b23299 100644 --- a/src/disk.c +++ b/src/disk.c @@ -389,7 +389,7 @@ static signed long long dict_get_value (CFDictionaryRef dict, const char *key) DEBUG ("CFStringCreateWithCString (%s) failed.", key); return (-1LL); } - + /* get => we don't need to release (== free) the object */ val_obj = (CFNumberRef) CFDictionaryGetValue (dict, key_obj); @@ -637,7 +637,7 @@ static int disk_read (void) #elif KERNEL_LINUX FILE *fh; char buffer[1024]; - + char *fields[32]; int numfields; int fieldshift = 0; @@ -936,10 +936,10 @@ static int disk_read (void) #endif int counter; char name[DATA_MAX_NAME_LEN]; - + if ((ds = sg_get_disk_io_stats(&disks)) == NULL) return (0); - + for (counter=0; counter < disks; counter++) { strncpy(name, ds->disk_name, sizeof(name)); name[sizeof(name)-1] = '\0'; /* strncpy doesn't terminate longer strings */ @@ -959,7 +959,7 @@ static int disk_read (void) int rnumdisk; int i; - if ((numdisk = perfstat_disk(NULL, NULL, sizeof(perfstat_disk_t), 0)) < 0) + if ((numdisk = perfstat_disk(NULL, NULL, sizeof(perfstat_disk_t), 0)) < 0) { char errbuf[1024]; WARNING ("disk plugin: perfstat_disk: %s", @@ -968,14 +968,14 @@ static int disk_read (void) } if (numdisk != pnumdisk || stat_disk==NULL) { - if (stat_disk!=NULL) + if (stat_disk!=NULL) free(stat_disk); stat_disk = (perfstat_disk_t *)calloc(numdisk, sizeof(perfstat_disk_t)); - } + } pnumdisk = numdisk; firstpath.name[0]='\0'; - if ((rnumdisk = perfstat_disk(&firstpath, stat_disk, sizeof(perfstat_disk_t), numdisk)) < 0) + if ((rnumdisk = perfstat_disk(&firstpath, stat_disk, sizeof(perfstat_disk_t), numdisk)) < 0) { char errbuf[1024]; WARNING ("disk plugin: perfstat_disk : %s", @@ -983,7 +983,7 @@ static int disk_read (void) return (-1); } - for (i = 0; i < rnumdisk; i++) + for (i = 0; i < rnumdisk; i++) { read_sectors = stat_disk[i].rblks*stat_disk[i].bsize; write_sectors = stat_disk[i].wblks*stat_disk[i].bsize; diff --git a/src/drbd.c b/src/drbd.c index d46bb020..f0298943 100644 --- a/src/drbd.c +++ b/src/drbd.c @@ -28,7 +28,7 @@ See: http://www.drbd.org/users-guide/ch-admin.html#s-performance-indicators version: 8.3.11 (api:88/proto:86-96) - srcversion: 71955441799F513ACA6DA60 + srcversion: 71955441799F513ACA6DA60 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate B r----- ns:64363752 nr:0 dw:357799284 dr:846902273 al:34987022 bm:18062 lo:0 \ pe:0 ua:0 ap:0 ep:1 wo:f oos:0 diff --git a/src/filecount.c b/src/filecount.c index 3b5038cd..270e5d05 100644 --- a/src/filecount.c +++ b/src/filecount.c @@ -23,7 +23,7 @@ #include "collectd.h" #include "common.h" -#include "plugin.h" +#include "plugin.h" #include #include @@ -541,7 +541,7 @@ static int fc_read_dir (fc_directory_conf_t *dir) if (dir->mtime != 0) dir->now = time (NULL); - + status = walk_directory (dir->path, fc_read_dir_callback, dir, /* include hidden */ (dir->options & FC_HIDDEN) ? 1 : 0); if (status != 0) diff --git a/src/gmond.c b/src/gmond.c index c763cd96..1aa95d57 100644 --- a/src/gmond.c +++ b/src/gmond.c @@ -912,7 +912,7 @@ static int mc_receive_thread_stop (void) /* {{{ */ return (0); } /* }}} int mc_receive_thread_stop */ -/* +/* * Config: * * diff --git a/src/ipmi.c b/src/ipmi.c index 51d33dcb..76dd9cbd 100644 --- a/src/ipmi.c +++ b/src/ipmi.c @@ -279,7 +279,7 @@ static int sensor_list_add (ipmi_sensor_t *sensor) { /* `sensor_id_ptr' now points to "(123)". */ ssnprintf (sensor_name, sizeof (sensor_name), - "%s %s", sensor_name_ptr, sensor_id_ptr); + "%s %s", sensor_name_ptr, sensor_id_ptr); } /* else: don't touch sensor_name. */ } diff --git a/src/libcollectdclient/collectd/network.h b/src/libcollectdclient/collectd/network.h index 049f7f02..64cf9c93 100644 --- a/src/libcollectdclient/collectd/network.h +++ b/src/libcollectdclient/collectd/network.h @@ -56,7 +56,7 @@ typedef enum lcc_security_level_e lcc_security_level_t; lcc_network_t *lcc_network_create (void); void lcc_network_destroy (lcc_network_t *net); -/* +/* * Add servers */ lcc_server_t *lcc_server_create (lcc_network_t *net, diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index b4b82442..ca7f958f 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -176,7 +176,7 @@ oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig) for (i = 0; i < ci_copy->children_num; i++) { oconfig_item_t *child; - + child = oconfig_clone (ci_orig->children + i); if (child == NULL) { diff --git a/src/madwifi.c b/src/madwifi.c index d0b2f83e..949724eb 100644 --- a/src/madwifi.c +++ b/src/madwifi.c @@ -23,7 +23,7 @@ /** - * There are several data streams provided by Madwifi plugin, some are + * There are several data streams provided by Madwifi plugin, some are * connected to network interface, some are connected to each node * associated to that interface. Nodes represents other sides in * wireless communication, for example on network interface in AP mode, @@ -42,18 +42,18 @@ * node_stat Node statistic counters * * Both statistic counters have type instances for each counter returned - * by Madwifi. See madwifi.h for content of ieee80211_nodestats, + * by Madwifi. See madwifi.h for content of ieee80211_nodestats, * ieee80211_stats and ath_stats structures. Type instances use the same * name as fields in these structures (like ns_rx_dup). Some fields are * not reported, because they are not counters (like ns_tx_deauth_code * or ast_tx_rssi). Fields ns_rx_bytes and ns_tx_bytes are reported as * node_octets data stream instead of type instance of node_stat. * Statistics are not logged when they are zero. - * + * * There are two sets of these counters - the first 'WatchList' is a * set of counters that are individually logged. The second 'MiscList' * is a set of counters that are summed together and the sum is logged. - * By default, the most important statistics are in the WatchList and + * By default, the most important statistics are in the WatchList and * many error statistics are in MiscList. There are also many statistics * that are not in any of these sets, so they are not monitored by default. * It is possible to alter these lists using configuration options: @@ -629,7 +629,7 @@ process_stat_struct (int which, const void *ptr, const char *dev, const char *ma if (item_summed (i)) misc += val; } - + if (misc != 0) submit_derive (dev, type_name, misc_name, mac, misc); @@ -891,7 +891,7 @@ procfs_iterate(int sk) int status; int num_success; int num_fail; - + if ((fh = fopen ("/proc/net/dev", "r")) == NULL) { WARNING ("madwifi plugin: opening /proc/net/dev failed"); @@ -953,7 +953,7 @@ static int madwifi_read (void) /* procfs iteration is not safe because it does not check whether given interface is madwifi interface and there are private ioctls used, which - may do something completely different on non-madwifi devices. + may do something completely different on non-madwifi devices. Therefore, it is not used unless explicitly enabled (and should be used together with ignorelist). */ diff --git a/src/match_regex.c b/src/match_regex.c index 6e6bda2a..bbc35cd4 100644 --- a/src/match_regex.c +++ b/src/match_regex.c @@ -162,7 +162,7 @@ static int mr_config_add_regex (mr_regex_t **re_head, /* {{{ */ char errmsg[1024]; regerror (status, &re->re, errmsg, sizeof (errmsg)); errmsg[sizeof (errmsg) - 1] = 0; - log_err ("Compiling regex `%s' for `%s' failed: %s.", + log_err ("Compiling regex `%s' for `%s' failed: %s.", re->re_str, ci->key, errmsg); free (re->re_str); free (re); diff --git a/src/match_value.c b/src/match_value.c index 8c6fd36c..64e11367 100644 --- a/src/match_value.c +++ b/src/match_value.c @@ -59,7 +59,7 @@ struct mv_match_s static void mv_free_match (mv_match_t *m) /* {{{ */ { size_t i; - + if (m == NULL) return; @@ -69,7 +69,7 @@ static void mv_free_match (mv_match_t *m) /* {{{ */ free(m->data_sources[i]); free(m->data_sources); } - + free (m); } /* }}} void mv_free_match */ diff --git a/src/modbus.c b/src/modbus.c index 2605ec23..51447b16 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -80,7 +80,7 @@ enum mb_register_type_e /* {{{ */ REG_TYPE_UINT32, REG_TYPE_FLOAT }; /* }}} */ -enum mb_mreg_type_e /* {{{ */ +enum mb_mreg_type_e /* {{{ */ { MREG_HOLDING, MREG_INPUT @@ -503,7 +503,7 @@ static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */ modbus_free (host->connection); #endif } - + #if LEGACY_LIBMODBUS /* Version 2.0.3: Pass the connection struct as a pointer and pass the slave * id to each call of "read_holding_registers". */ diff --git a/src/mysql.c b/src/mysql.c index 4c94732b..a2394137 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -738,7 +738,7 @@ static int mysql_read (user_data_t *ud) key = row[0]; val = atoll (row[1]); - if (strncmp (key, "Com_", + if (strncmp (key, "Com_", strlen ("Com_")) == 0) { if (val == 0ULL) @@ -746,18 +746,18 @@ static int mysql_read (user_data_t *ud) /* Ignore `prepared statements' */ if (strncmp (key, "Com_stmt_", strlen ("Com_stmt_")) != 0) - counter_submit ("mysql_commands", - key + strlen ("Com_"), + counter_submit ("mysql_commands", + key + strlen ("Com_"), val, db); } - else if (strncmp (key, "Handler_", + else if (strncmp (key, "Handler_", strlen ("Handler_")) == 0) { if (val == 0ULL) continue; - counter_submit ("mysql_handler", - key + strlen ("Handler_"), + counter_submit ("mysql_handler", + key + strlen ("Handler_"), val, db); } else if (strncmp (key, "Qcache_", @@ -774,7 +774,7 @@ static int mysql_read (user_data_t *ud) else if (strcmp (key, "Qcache_queries_in_cache") == 0) qcache_queries_in_cache = (gauge_t) val; } - else if (strncmp (key, "Bytes_", + else if (strncmp (key, "Bytes_", strlen ("Bytes_")) == 0) { if (strcmp (key, "Bytes_received") == 0) @@ -782,7 +782,7 @@ static int mysql_read (user_data_t *ud) else if (strcmp (key, "Bytes_sent") == 0) traffic_outgoing += val; } - else if (strncmp (key, "Threads_", + else if (strncmp (key, "Threads_", strlen ("Threads_")) == 0) { if (strcmp (key, "Threads_running") == 0) @@ -902,7 +902,7 @@ static int mysql_read (user_data_t *ud) counter_submit ("mysql_sort", "range", val, db); else if (strcmp (key, "Sort_scan") == 0) counter_submit ("mysql_sort", "scan", val, db); - + } } mysql_free_result (res); res = NULL; diff --git a/src/netapp.c b/src/netapp.c index 51a63318..e00c2529 100644 --- a/src/netapp.c +++ b/src/netapp.c @@ -879,7 +879,7 @@ static cdtime_t cna_child_get_cdtime (na_elem_t *data) /* {{{ */ } /* }}} cdtime_t cna_child_get_cdtime */ -/* +/* * Query functions * * These functions are called with appropriate data returned by the libnetapp @@ -897,7 +897,7 @@ static int cna_handle_wafl_data (const char *hostname, cfg_wafl_t *cfg_wafl, /* na_elem_iter_t counter_iter; memset (&perf_data, 0, sizeof (perf_data)); - + perf_data.timestamp = cna_child_get_cdtime (data); instances = na_elem_child(na_elem_child (data, "instances"), "instance-data"); @@ -1062,7 +1062,7 @@ static int cna_handle_disk_data (const char *hostname, /* {{{ */ if ((cfg_disk == NULL) || (data == NULL)) return (EINVAL); - + timestamp = cna_child_get_cdtime (data); instances = na_elem_child (data, "instances"); @@ -1254,7 +1254,7 @@ static int cna_handle_volume_perf_data (const char *hostname, /* {{{ */ na_elem_t *elem_instances; na_elem_iter_t iter_instances; na_elem_t *elem_instance; - + timestamp = cna_child_get_cdtime (data); elem_instances = na_elem_child(data, "instances"); @@ -1733,7 +1733,7 @@ static int cna_handle_volume_usage_data (const host_config_t *host, /* {{{ */ if ((v->flags & CFG_VOLUME_USAGE_SNAP) != 0) cna_handle_volume_snap_usage(host, v); - + if ((v->flags & CFG_VOLUME_USAGE_DF) == 0) continue; @@ -2128,7 +2128,7 @@ static int cna_handle_system_data (const char *hostname, /* {{{ */ const char *instance; cdtime_t timestamp; - + timestamp = cna_child_get_cdtime (data); instances = na_elem_child(na_elem_child (data, "instances"), "instance-data"); @@ -2195,7 +2195,7 @@ static int cna_handle_system_data (const char *hostname, /* {{{ */ && (HAS_ALL_FLAGS (counter_flags, 0x01 | 0x02))) submit_two_derive (hostname, instance, "disk_octets", NULL, disk_read, disk_written, timestamp, interval); - + if ((cfg_system->flags & CFG_SYSTEM_NET) && (HAS_ALL_FLAGS (counter_flags, 0x04 | 0x08))) submit_two_derive (hostname, instance, "if_octets", NULL, @@ -2437,10 +2437,10 @@ static int cna_config_volume_performance (host_config_t *host, /* {{{ */ host->cfg_volume_perf = cfg_volume_perf; } cfg_volume_perf = host->cfg_volume_perf; - + for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + /* if (!item || !item->key || !*item->key) continue; */ if (strcasecmp(item->key, "Interval") == 0) cna_config_get_interval (item, &cfg_volume_perf->interval); @@ -2573,10 +2573,10 @@ static int cna_config_disk(host_config_t *host, oconfig_item_t *ci) { /* {{{ */ host->cfg_disk = cfg_disk; } cfg_disk = host->cfg_disk; - + for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + /* if (!item || !item->key || !*item->key) continue; */ if (strcasecmp(item->key, "Interval") == 0) cna_config_get_interval (item, &cfg_disk->interval); @@ -2619,7 +2619,7 @@ static int cna_config_wafl(host_config_t *host, oconfig_item_t *ci) /* {{{ */ for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + if (strcasecmp(item->key, "Interval") == 0) cna_config_get_interval (item, &cfg_wafl->interval); else if (!strcasecmp(item->key, "GetNameCache")) @@ -2700,10 +2700,10 @@ static int cna_config_volume_usage(host_config_t *host, /* {{{ */ host->cfg_volume_usage = cfg_volume_usage; } cfg_volume_usage = host->cfg_volume_usage; - + for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + /* if (!item || !item->key || !*item->key) continue; */ if (strcasecmp(item->key, "Interval") == 0) cna_config_get_interval (item, &cfg_volume_usage->interval); diff --git a/src/nfs.c b/src/nfs.c index a921a177..0948bc79 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -221,7 +221,7 @@ static size_t nfs4_server40_procedures_names_num = STATIC_ARRAY_SIZE (nfs4_serve static const char *nfs4_server41_procedures_names[] = { "backchannel_ctl", - "bind_conn_to_session", + "bind_conn_to_session", "exchange_id", "create_session", "destroy_session", @@ -404,7 +404,7 @@ static void nfs_procedures_submit (const char *plugin_instance, } /* void nfs_procedures_submit */ #if KERNEL_LINUX -static void nfs_submit_fields (int nfs_version, const char *instance, +static void nfs_submit_fields (int nfs_version, const char *instance, char **fields, size_t fields_num, const char **proc_names) { char plugin_instance[DATA_MAX_NAME_LEN]; @@ -434,19 +434,19 @@ static int nfs_submit_fields_safe (int nfs_version, const char *instance, return (EINVAL); } - nfs_submit_fields (nfs_version, instance, fields, fields_num, + nfs_submit_fields (nfs_version, instance, fields, fields_num, proc_names); return (0); } -static int nfs_submit_nfs4_server (const char *instance, char **fields, +static int nfs_submit_nfs4_server (const char *instance, char **fields, size_t fields_num) { static int suppress_warning = 0; if (fields_num != NFS4_SERVER40_NUM_PROC && - fields_num != NFS4_SERVER41_NUM_PROC) + fields_num != NFS4_SERVER41_NUM_PROC) { if (!suppress_warning) { @@ -466,7 +466,7 @@ static int nfs_submit_nfs4_server (const char *instance, char **fields, } } - nfs_submit_fields (4, instance, fields, + nfs_submit_fields (4, instance, fields, nfs4_server40_procedures_names_num, nfs4_server40_procedures_names); @@ -474,15 +474,15 @@ static int nfs_submit_nfs4_server (const char *instance, char **fields, { fields += nfs4_server40_procedures_names_num; - nfs_submit_fields (4, instance, fields, - nfs4_server41_procedures_names_num, + nfs_submit_fields (4, instance, fields, + nfs4_server41_procedures_names_num, nfs4_server41_procedures_names); } return (0); } -static int nfs_submit_nfs4_client (const char *instance, char **fields, +static int nfs_submit_nfs4_client (const char *instance, char **fields, size_t fields_num) { size_t proc40_names_num, proc41_names_num; @@ -589,14 +589,14 @@ static void nfs_read_linux (FILE *fh, const char *inst) else if (strcmp (fields[0], "proc4ops") == 0) { if (inst[0] == 's') - nfs_submit_nfs4_server (inst, fields + 2, + nfs_submit_nfs4_server (inst, fields + 2, (size_t) (fields_num - 2)); } else if (strcmp (fields[0], "proc4") == 0) { if (inst[0] == 'c') nfs_submit_nfs4_client (inst, fields + 2, - (size_t) (fields_num - 2)); + (size_t) (fields_num - 2)); } } /* while (fgets) */ } /* void nfs_read_linux */ diff --git a/src/notify_email.c b/src/notify_email.c index 76d48d44..6843987c 100644 --- a/src/notify_email.c +++ b/src/notify_email.c @@ -66,7 +66,7 @@ static char *email_subject = NULL; /* Callback to get username and password */ static int authinteract (auth_client_request_t request, char **result, int fields, void __attribute__((unused)) *arg) -{ +{ int i; for (i = 0; i < fields; i++) { @@ -145,7 +145,7 @@ static int notify_email_init (void) if ( !smtp_auth_set_context (session, authctx)) { pthread_mutex_unlock (&session_lock); ERROR ("notify_email plugin: cannot set SMTP auth context"); - return (-1); + return (-1); } pthread_mutex_unlock (&session_lock); @@ -282,7 +282,7 @@ static int notify_email_notification (const notification_t *n, if (!(message = smtp_add_message (session))) { pthread_mutex_unlock (&session_lock); ERROR ("notify_email plugin: cannot set SMTP message"); - return (-1); + return (-1); } smtp_set_reverse_path (message, email_from); smtp_set_header (message, "To", NULL, NULL); diff --git a/src/olsrd.c b/src/olsrd.c index bbf387f4..6be7cb58 100644 --- a/src/olsrd.c +++ b/src/olsrd.c @@ -622,7 +622,7 @@ static int olsrd_read_table (FILE *fh, /* {{{ */ (*callback) (lineno, fields_num, fields); lineno++; } /* while (fgets) */ - + return (0); } /* }}} int olsrd_read_table */ @@ -665,7 +665,7 @@ static int olsrd_read (void) /* {{{ */ buffer_len = strchomp (buffer); if (buffer_len <= 0) continue; - + if (strcmp ("Table: Links", buffer) == 0) olsrd_read_table (fh, olsrd_cb_links); else if (strcmp ("Table: Neighbors", buffer) == 0) @@ -690,7 +690,7 @@ static int olsrd_read (void) /* {{{ */ } /* while (fgets) */ fclose (fh); - + return (0); } /* }}} int olsrd_read */ diff --git a/src/openldap.c b/src/openldap.c index 055f2d16..36a29f8d 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -130,7 +130,7 @@ static int cldap_init_host (cldap_t *st) /* {{{ */ cred.bv_len = 0; } - rc = ldap_sasl_bind_s (st->ld, st->binddn, LDAP_SASL_SIMPLE, &cred, + rc = ldap_sasl_bind_s (st->ld, st->binddn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL); if (rc != LDAP_SUCCESS) { diff --git a/src/oracle.c b/src/oracle.c index 3e4653d5..55139dd1 100644 --- a/src/oracle.c +++ b/src/oracle.c @@ -174,7 +174,7 @@ static void o_database_free (o_database_t *db) /* {{{ */ * ValuesFrom "value" * * - * + * * * ConnectID "db01" * Username "oracle" @@ -462,7 +462,7 @@ static int o_read_database_query (o_database_t *db, /* {{{ */ { ub4 param_counter = 0; status = OCIAttrGet (oci_statement, OCI_HTYPE_STMT, /* {{{ */ - ¶m_counter, /* size pointer = */ NULL, + ¶m_counter, /* size pointer = */ NULL, OCI_ATTR_PARAM_COUNT, oci_error); if (status != OCI_SUCCESS) { @@ -475,7 +475,7 @@ static int o_read_database_query (o_database_t *db, /* {{{ */ } while (0); /* }}} */ /* Allocate the following buffers: - * + * * +---------------+-----------------------------------+ * ! Name ! Size ! * +---------------+-----------------------------------+ @@ -651,7 +651,7 @@ static int o_read_database (o_database_t *db) /* {{{ */ ub4 connection_status; server_handle = NULL; - status = OCIAttrGet ((void *) db->oci_service_context, OCI_HTYPE_SVCCTX, + status = OCIAttrGet ((void *) db->oci_service_context, OCI_HTYPE_SVCCTX, (void *) &server_handle, /* size pointer = */ NULL, OCI_ATTR_SERVER, oci_error); if (status != OCI_SUCCESS) @@ -743,7 +743,7 @@ static int o_shutdown (void) /* {{{ */ OCIHandleFree (databases[i]->oci_service_context, OCI_HTYPE_SVCCTX); databases[i]->oci_service_context = NULL; } - + for (i = 0; i < queries_num; i++) { OCIStmt *oci_statement; @@ -755,7 +755,7 @@ static int o_shutdown (void) /* {{{ */ udb_query_set_user_data (queries[i], NULL); } } - + OCIHandleFree (oci_env, OCI_HTYPE_ENV); oci_env = NULL; diff --git a/src/pinba.c b/src/pinba.c index f6ddcdaf..980fbf26 100644 --- a/src/pinba.c +++ b/src/pinba.c @@ -171,7 +171,7 @@ static void service_statnode_add(const char *name, /* {{{ */ const char *script) { pinba_statnode_t *node; - + node = realloc (stat_nodes, sizeof (*stat_nodes) * (stat_nodes_num + 1)); if (node == NULL) @@ -183,7 +183,7 @@ static void service_statnode_add(const char *name, /* {{{ */ node = stat_nodes + stat_nodes_num; memset (node, 0, sizeof (*node)); - + /* reset strings */ node->name = NULL; node->host = NULL; @@ -191,13 +191,13 @@ static void service_statnode_add(const char *name, /* {{{ */ node->script = NULL; node->mem_peak = NAN; - + /* fill query data */ strset (&node->name, name); strset (&node->host, host); strset (&node->server, server); strset (&node->script, script); - + /* increment counter */ stat_nodes_num++; } /* }}} void service_statnode_add */ @@ -209,14 +209,14 @@ static unsigned int service_statnode_collect (pinba_statnode_t *res, /* {{{ */ unsigned int index) { pinba_statnode_t *node; - + if (stat_nodes_num == 0) return 0; - + /* begin collecting */ if (index == 0) pthread_mutex_lock (&stat_nodes_lock); - + /* end collecting */ if (index >= stat_nodes_num) { @@ -229,7 +229,7 @@ static unsigned int service_statnode_collect (pinba_statnode_t *res, /* {{{ */ /* reset node */ node->mem_peak = NAN; - + return (index + 1); } /* }}} unsigned int service_statnode_collect */ @@ -255,7 +255,7 @@ static void service_process_request (Pinba__Request *request) /* {{{ */ unsigned int i; pthread_mutex_lock (&stat_nodes_lock); - + for (i = 0; i < stat_nodes_num; i++) { if ((stat_nodes[i].host != NULL) @@ -272,7 +272,7 @@ static void service_process_request (Pinba__Request *request) /* {{{ */ service_statnode_process(&stat_nodes[i], request); } - + pthread_mutex_unlock(&stat_nodes_lock); } /* }}} void service_process_request */ @@ -395,7 +395,7 @@ static pinba_socket_t *pinba_socket_open (const char *node, /* {{{ */ if (status != 0) break; } /* for (ai_list) */ - + freeaddrinfo (ai_list); if (s->fd_num < 1) @@ -414,7 +414,7 @@ static void pinba_socket_free (pinba_socket_t *socket) /* {{{ */ if (!socket) return; - + for (i = 0; i < socket->fd_num; i++) { if (socket->fd[i].fd < 0) @@ -422,23 +422,23 @@ static void pinba_socket_free (pinba_socket_t *socket) /* {{{ */ close (socket->fd[i].fd); socket->fd[i].fd = -1; } - + sfree(socket); } /* }}} void pinba_socket_free */ static int pinba_process_stats_packet (const uint8_t *buffer, /* {{{ */ size_t buffer_size) { - Pinba__Request *request; - + Pinba__Request *request; + request = pinba__request__unpack (NULL, buffer_size, buffer); - + if (!request) return (-1); service_process_request(request); pinba__request__free_unpacked (request, NULL); - + return (0); } /* }}} int pinba_process_stats_packet */ @@ -609,7 +609,7 @@ static int pinba_config_view (const oconfig_item_t *ci) /* {{{ */ static int plugin_config (oconfig_item_t *ci) /* {{{ */ { int i; - + /* The lock should not be necessary in the config callback, but let's be * sure.. */ pthread_mutex_lock (&stat_nodes_lock); @@ -629,7 +629,7 @@ static int plugin_config (oconfig_item_t *ci) /* {{{ */ } pthread_mutex_unlock(&stat_nodes_lock); - + return (0); } /* }}} int pinba_config */ @@ -693,7 +693,7 @@ static int plugin_submit (const pinba_statnode_t *res) /* {{{ */ { value_t value; value_list_t vl = VALUE_LIST_INIT; - + vl.values = &value; vl.values_len = 1; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); @@ -701,15 +701,15 @@ static int plugin_submit (const pinba_statnode_t *res) /* {{{ */ sstrncpy (vl.plugin_instance, res->name, sizeof (vl.plugin_instance)); value.derive = res->req_count; - sstrncpy (vl.type, "total_requests", sizeof (vl.type)); + sstrncpy (vl.type, "total_requests", sizeof (vl.type)); plugin_dispatch_values (&vl); value.derive = float_counter_get (&res->req_time, /* factor = */ 1000); - sstrncpy (vl.type, "total_time_in_ms", sizeof (vl.type)); + sstrncpy (vl.type, "total_time_in_ms", sizeof (vl.type)); plugin_dispatch_values (&vl); value.derive = res->doc_size; - sstrncpy (vl.type, "total_bytes", sizeof (vl.type)); + sstrncpy (vl.type, "total_bytes", sizeof (vl.type)); plugin_dispatch_values (&vl); value.derive = float_counter_get (&res->ru_utime, /* factor = */ 100); @@ -734,12 +734,12 @@ static int plugin_read (void) /* {{{ */ { unsigned int i=0; pinba_statnode_t data; - + while ((i = service_statnode_collect (&data, i)) != 0) { plugin_submit (&data); } - + return 0; } /* }}} int plugin_read */ diff --git a/src/ping.c b/src/ping.c index b6b2b688..88661e94 100644 --- a/src/ping.c +++ b/src/ping.c @@ -399,7 +399,7 @@ static int start_thread (void) /* {{{ */ pthread_mutex_unlock (&ping_lock); return (-1); } - + pthread_mutex_unlock (&ping_lock); return (0); } /* }}} int start_thread */ diff --git a/src/postgresql.c b/src/postgresql.c index 6cf56318..b4b4ca77 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -555,7 +555,7 @@ static int c_psql_exec_query (c_psql_database_t *db, udb_query_t *q, log_err ("calloc failed."); BAIL_OUT (-1); } - + for (col = 0; col < column_num; ++col) { /* Pointers returned by `PQfname' are freed by `PQclear' via * `BAIL_OUT'. */ @@ -867,7 +867,7 @@ static int c_psql_write (const data_set_t *ds, const value_list_t *vl, #undef VALUE_OR_NULL if( db->expire_delay > 0 && vl->time < (cdtime() - vl->interval - db->expire_delay) ) { - log_info ("c_psql_write: Skipped expired value @ %s - %s/%s-%s/%s-%s/%s", + log_info ("c_psql_write: Skipped expired value @ %s - %s/%s-%s/%s-%s/%s", params[0], params[1], params[2], params[3], params[4], params[5], params[6] ); return 0; } diff --git a/src/protocols.c b/src/protocols.c index 1a39aad3..4d2b2ead 100644 --- a/src/protocols.c +++ b/src/protocols.c @@ -48,7 +48,7 @@ static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); static ignorelist_t *values_list = NULL; -/* +/* * Functions */ static void submit (const char *protocol_name, diff --git a/src/pyconfig.c b/src/pyconfig.c index b5c01aaf..32b31cc5 100644 --- a/src/pyconfig.c +++ b/src/pyconfig.c @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Sven Trenkel + * Sven Trenkel **/ #include @@ -57,11 +57,11 @@ static char children_doc[] = "This is a tuple of child nodes. For most nodes thi static PyObject *Config_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { Config *self; - + self = (Config *) type->tp_alloc(type, 0); if (self == NULL) return NULL; - + self->parent = NULL; self->key = NULL; self->values = NULL; @@ -73,11 +73,11 @@ static int Config_init(PyObject *s, PyObject *args, PyObject *kwds) { PyObject *key = NULL, *parent = NULL, *values = NULL, *children = NULL, *tmp; Config *self = (Config *) s; static char *kwlist[] = {"key", "parent", "values", "children", NULL}; - + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOO", kwlist, &key, &parent, &values, &children)) return -1; - + if (!IS_BYTES_OR_UNICODE(key)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be str"); Py_XDECREF(parent); @@ -122,7 +122,7 @@ static PyObject *Config_repr(PyObject *s) { Config *self = (Config *) s; PyObject *ret = NULL; static PyObject *node_prefix = NULL, *root_prefix = NULL, *ending = NULL; - + /* This is ok because we have the GIL, so this is thread-save by default. */ if (node_prefix == NULL) node_prefix = cpy_string_to_unicode_or_bytes(""); if (node_prefix == NULL || root_prefix == NULL || ending == NULL) return NULL; - + ret = PyObject_Str(self->key); CPY_SUBSTITUTE(PyObject_Repr, ret, ret); if (self->parent == NULL || self->parent == Py_None) @@ -140,7 +140,7 @@ static PyObject *Config_repr(PyObject *s) { else CPY_STRCAT(&ret, node_prefix); CPY_STRCAT(&ret, ending); - + return ret; } diff --git a/src/python.c b/src/python.c index 1f808496..1ed6dc01 100644 --- a/src/python.c +++ b/src/python.c @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Sven Trenkel + * Sven Trenkel **/ #include @@ -250,16 +250,16 @@ static void cpy_destroy_user_data(void *data) { static void cpy_build_name(char *buf, size_t size, PyObject *callback, const char *name) { const char *module = NULL; PyObject *mod = NULL; - + if (name != NULL) { snprintf(buf, size, "python.%s", name); return; } - + mod = PyObject_GetAttrString(callback, "__module__"); /* New reference. */ if (mod != NULL) module = cpy_unicode_or_bytes_to_string(&mod); - + if (module != NULL) { snprintf(buf, size, "python.%s", module); Py_XDECREF(mod); @@ -267,7 +267,7 @@ static void cpy_build_name(char *buf, size_t size, PyObject *callback, const cha return; } Py_XDECREF(mod); - + snprintf(buf, size, "python.%p", callback); PyErr_Clear(); } @@ -276,7 +276,7 @@ void cpy_log_exception(const char *context) { int l = 0, i; const char *typename = NULL, *message = NULL; PyObject *type, *value, *traceback, *tn, *m, *list; - + PyErr_Fetch(&type, &value, &traceback); PyErr_NormalizeException(&type, &value, &traceback); if (type == NULL) return; @@ -402,7 +402,7 @@ static int cpy_write_callback(const data_set_t *ds, const value_list_t *value_li uint64_t ui; double d; _Bool b; - + type = meta_data_type(meta, table[i]); if (type == MD_TYPE_STRING) { if (meta_data_get_string(meta, table[i], &string)) @@ -540,7 +540,7 @@ static PyObject *cpy_register_generic(cpy_callback_t **list_head, PyObject *args char *name = NULL; PyObject *callback = NULL, *data = NULL, *mod = NULL; static char *kwlist[] = {"callback", "data", "name", NULL}; - + if (PyArg_ParseTupleAndKeywords(args, kwds, "O|Oet", kwlist, &callback, &data, NULL, &name) == 0) return NULL; if (PyCallable_Check(callback) == 0) { PyMem_Free(name); @@ -602,7 +602,7 @@ static PyObject *cpy_flush(PyObject *self, PyObject *args, PyObject *kwds) { int timeout = -1; char *plugin = NULL, *identifier = NULL; static char *kwlist[] = {"plugin", "timeout", "identifier", NULL}; - + if (PyArg_ParseTupleAndKeywords(args, kwds, "|etiet", kwlist, NULL, &plugin, &timeout, NULL, &identifier) == 0) return NULL; Py_BEGIN_ALLOW_THREADS plugin_flush(plugin, timeout, identifier); @@ -630,7 +630,7 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec char *name = NULL; PyObject *callback = NULL, *data = NULL; static char *kwlist[] = {"callback", "data", "name", NULL}; - + if (PyArg_ParseTupleAndKeywords(args, kwds, "O|Oet", kwlist, &callback, &data, NULL, &name) == 0) return NULL; if (PyCallable_Check(callback) == 0) { PyMem_Free(name); @@ -639,7 +639,7 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec } cpy_build_name(buf, sizeof(buf), callback, name); PyMem_Free(name); - + Py_INCREF(callback); Py_XINCREF(data); @@ -668,7 +668,7 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwd char *name = NULL; PyObject *callback = NULL, *data = NULL; static char *kwlist[] = {"callback", "interval", "data", "name", NULL}; - + if (PyArg_ParseTupleAndKeywords(args, kwds, "O|dOet", kwlist, &callback, &interval, &data, NULL, &name) == 0) return NULL; if (PyCallable_Check(callback) == 0) { PyMem_Free(name); @@ -677,7 +677,7 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwd } cpy_build_name(buf, sizeof(buf), callback, name); PyMem_Free(name); - + Py_INCREF(callback); Py_XINCREF(data); @@ -900,7 +900,7 @@ static PyMethodDef cpy_methods[] = { static int cpy_shutdown(void) { cpy_callback_t *c; PyObject *ret; - + /* This can happen if the module was loaded but not configured. */ if (state != NULL) PyEval_RestoreThread(state); @@ -924,14 +924,14 @@ static void cpy_int_handler(int sig) { static void *cpy_interactive(void *data) { sigset_t sigset; struct sigaction sig_int_action, old; - + /* Signal handler in a plugin? Bad stuff, but the best way to * handle it I guess. In an interactive session people will * press Ctrl+C at some time, which will generate a SIGINT. * This will cause collectd to shutdown, thus killing the * interactive interpreter, and leaving the terminal in a * mess. Chances are, this isn't what the user wanted to do. - * + * * So this is the plan: * 1. Block SIGINT in the main thread. * 2. Install our own signal handler that does nothing. @@ -944,7 +944,7 @@ static void *cpy_interactive(void *data) { memset (&sig_int_action, '\0', sizeof (sig_int_action)); sig_int_action.sa_handler = cpy_int_handler; sigaction (SIGINT, &sig_int_action, &old); - + sigemptyset(&sigset); sigaddset(&sigset, SIGINT); pthread_sigmask(SIG_UNBLOCK, &sigset, NULL); @@ -973,7 +973,7 @@ static int cpy_init(void) { PyObject *ret; static pthread_t thread; sigset_t sigset; - + if (!Py_IsInitialized()) { WARNING("python: Plugin loaded but not configured."); plugin_unregister_shutdown("python"); @@ -1004,10 +1004,10 @@ static int cpy_init(void) { static PyObject *cpy_oconfig_to_pyconfig(oconfig_item_t *ci, PyObject *parent) { int i; PyObject *item, *values, *children, *tmp; - + if (parent == NULL) parent = Py_None; - + values = PyTuple_New(ci->values_num); /* New reference. */ for (i = 0; i < ci->values_num; ++i) { if (ci->values[i].type == OCONFIG_TYPE_STRING) { @@ -1018,7 +1018,7 @@ static PyObject *cpy_oconfig_to_pyconfig(oconfig_item_t *ci, PyObject *parent) { PyTuple_SET_ITEM(values, i, PyBool_FromLong(ci->values[i].value.boolean)); } } - + tmp = cpy_string_to_unicode_or_bytes(ci->key); item = PyObject_CallFunction((void *) &ConfigType, "NONO", tmp, parent, values, Py_None); if (item == NULL) @@ -1058,9 +1058,9 @@ static int cpy_init_python(void) { #else char *argv = ""; #endif - + Py_Initialize(); - + PyType_Ready(&ConfigType); PyType_Ready(&PluginDataType); ValuesType.tp_base = &PluginDataType; @@ -1125,7 +1125,7 @@ static int cpy_config(oconfig_item_t *ci) { for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + if (strcasecmp(item->key, "Interactive") == 0) { if (item->values_num != 1 || item->values[0].type != OCONFIG_TYPE_BOOLEAN) continue; @@ -1162,8 +1162,8 @@ static int cpy_config(oconfig_item_t *ci) { } else if (strcasecmp(item->key, "ModulePath") == 0) { char *dir = NULL; PyObject *dir_object; - - if (cf_util_get_string(item, &dir) != 0) + + if (cf_util_get_string(item, &dir) != 0) continue; dir_object = cpy_string_to_unicode_or_bytes(dir); /* New reference. */ if (dir_object == NULL) { @@ -1183,8 +1183,8 @@ static int cpy_config(oconfig_item_t *ci) { } else if (strcasecmp(item->key, "Import") == 0) { char *module_name = NULL; PyObject *module; - - if (cf_util_get_string(item, &module_name) != 0) + + if (cf_util_get_string(item, &module_name) != 0) continue; module = PyImport_ImportModule(module_name); /* New reference. */ if (module == NULL) { @@ -1197,7 +1197,7 @@ static int cpy_config(oconfig_item_t *ci) { char *name = NULL; cpy_callback_t *c; PyObject *ret; - + if (cf_util_get_string(item, &name) != 0) continue; for (c = cpy_config_callbacks; c; c = c->next) { diff --git a/src/pyvalues.c b/src/pyvalues.c index 1097f7ff..3c52ce5d 100644 --- a/src/pyvalues.c +++ b/src/pyvalues.c @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Sven Trenkel + * Sven Trenkel **/ #include @@ -45,7 +45,7 @@ static PyObject *cpy_common_repr(PyObject *s) { static PyObject *l_type = NULL, *l_type_instance = NULL, *l_plugin = NULL, *l_plugin_instance = NULL; static PyObject *l_host = NULL, *l_time = NULL; PluginData *self = (PluginData *) s; - + if (l_type == NULL) l_type = cpy_string_to_unicode_or_bytes("(type="); if (l_type_instance == NULL) @@ -58,10 +58,10 @@ static PyObject *cpy_common_repr(PyObject *s) { l_host = cpy_string_to_unicode_or_bytes(",host="); if (l_time == NULL) l_time = cpy_string_to_unicode_or_bytes(",time="); - + if (!l_type || !l_type_instance || !l_plugin || !l_plugin_instance || !l_host || !l_time) return NULL; - + ret = cpy_string_to_unicode_or_bytes(s->ob_type->tp_name); CPY_STRCAT(&ret, l_type); @@ -134,11 +134,11 @@ static char PluginData_doc[] = "This is an internal class that is the base for V static PyObject *PluginData_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PluginData *self; - + self = (PluginData *) type->tp_alloc(type, 0); if (self == NULL) return NULL; - + self->time = 0; self->host[0] = 0; self->plugin[0] = 0; @@ -154,11 +154,11 @@ static int PluginData_init(PyObject *s, PyObject *args, PyObject *kwds) { char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL; static char *kwlist[] = {"type", "plugin_instance", "type_instance", "plugin", "host", "time", NULL}; - + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etetetetetd", kwlist, NULL, &type, NULL, &plugin_instance, NULL, &type_instance, NULL, &plugin, NULL, &host, &time)) return -1; - + if (type && plugin_get_ds(type) == NULL) { PyErr_Format(PyExc_TypeError, "Dataset %s not found", type); FreeAll(); @@ -180,13 +180,13 @@ static int PluginData_init(PyObject *s, PyObject *args, PyObject *kwds) { static PyObject *PluginData_repr(PyObject *s) { PyObject *ret; static PyObject *l_closing = NULL; - + if (l_closing == NULL) l_closing = cpy_string_to_unicode_or_bytes(")"); - + if (l_closing == NULL) return NULL; - + ret = cpy_common_repr(s); CPY_STRCAT(&ret, l_closing); return ret; @@ -199,14 +199,14 @@ static PyMemberDef PluginData_members[] = { static PyObject *PluginData_getstring(PyObject *self, void *data) { const char *value = ((char *) self) + (intptr_t) data; - + return cpy_string_to_unicode_or_bytes(value); } static int PluginData_setstring(PyObject *self, PyObject *value, void *data) { char *old; const char *new; - + if (value == NULL) { PyErr_SetString(PyExc_TypeError, "Cannot delete this attribute"); return -1; @@ -226,7 +226,7 @@ static int PluginData_setstring(PyObject *self, PyObject *value, void *data) { static int PluginData_settype(PyObject *self, PyObject *value, void *data) { char *old; const char *new; - + if (value == NULL) { PyErr_SetString(PyExc_TypeError, "Cannot delete this attribute"); return -1; @@ -349,11 +349,11 @@ static char Values_doc[] = "A Values object used for dispatching values to colle static PyObject *Values_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { Values *self; - + self = (Values *) PluginData_new(type, args, kwds); if (self == NULL) return NULL; - + self->values = PyList_New(0); self->meta = PyDict_New(); self->interval = 0; @@ -367,12 +367,12 @@ static int Values_init(PyObject *s, PyObject *args, PyObject *kwds) { char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL; static char *kwlist[] = {"type", "values", "plugin_instance", "type_instance", "plugin", "host", "time", "interval", "meta", NULL}; - + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetddO", kwlist, NULL, &type, &values, NULL, &plugin_instance, NULL, &type_instance, NULL, &plugin, NULL, &host, &time, &interval, &meta)) return -1; - + if (type && plugin_get_ds(type) == NULL) { PyErr_Format(PyExc_TypeError, "Dataset %s not found", type); FreeAll(); @@ -394,18 +394,18 @@ static int Values_init(PyObject *s, PyObject *args, PyObject *kwds) { } else { Py_INCREF(values); } - + if (meta == NULL) { meta = PyDict_New(); PyErr_Clear(); } else { Py_INCREF(meta); } - + tmp = self->values; self->values = values; Py_XDECREF(tmp); - + tmp = self->meta; self->meta = meta; Py_XDECREF(tmp); @@ -418,7 +418,7 @@ static meta_data_t *cpy_build_meta(PyObject *meta) { int i, s; meta_data_t *m = NULL; PyObject *l; - + if ((meta == NULL) || (meta == Py_None)) return NULL; @@ -437,7 +437,7 @@ static meta_data_t *cpy_build_meta(PyObject *meta) { for (i = 0; i < s; ++i) { const char *string, *keystring; PyObject *key, *value, *item, *tmp; - + item = PyList_GET_ITEM(l, i); key = PyTuple_GET_ITEM(item, 0); Py_INCREF(key); @@ -510,7 +510,7 @@ static PyObject *Values_dispatch(Values *self, PyObject *args, PyObject *kwds) { PyObject *values = self->values, *meta = self->meta; double time = self->data.time, interval = self->interval; char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL; - + static char *kwlist[] = {"type", "values", "plugin_instance", "type_instance", "plugin", "host", "time", "interval", "meta", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetddO", kwlist, @@ -619,7 +619,7 @@ static PyObject *Values_write(Values *self, PyObject *args, PyObject *kwds) { PyObject *values = self->values, *meta = self->meta; double time = self->data.time, interval = self->interval; char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL, *dest = NULL; - + static char *kwlist[] = {"destination", "type", "values", "plugin_instance", "type_instance", "plugin", "host", "time", "interval", "meta", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|etOetetetetdiO", kwlist, NULL, &dest, @@ -718,7 +718,7 @@ static PyObject *Values_repr(PyObject *s) { PyObject *ret, *tmp; static PyObject *l_interval = NULL, *l_values = NULL, *l_meta = NULL, *l_closing = NULL; Values *self = (Values *) s; - + if (l_interval == NULL) l_interval = cpy_string_to_unicode_or_bytes(",interval="); if (l_values == NULL) @@ -727,10 +727,10 @@ static PyObject *Values_repr(PyObject *s) { l_meta = cpy_string_to_unicode_or_bytes(",meta="); if (l_closing == NULL) l_closing = cpy_string_to_unicode_or_bytes(")"); - + if (l_interval == NULL || l_values == NULL || l_meta == NULL || l_closing == NULL) return NULL; - + ret = cpy_common_repr(s); if (self->interval != 0) { CPY_STRCAT(&ret, l_interval); @@ -844,12 +844,12 @@ static int Notification_init(PyObject *s, PyObject *args, PyObject *kwds) { char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL; static char *kwlist[] = {"type", "message", "plugin_instance", "type_instance", "plugin", "host", "time", "severity", NULL}; - + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etetetetetetdi", kwlist, NULL, &type, NULL, &message, NULL, &plugin_instance, NULL, &type_instance, NULL, &plugin, NULL, &host, &time, &severity)) return -1; - + if (type && plugin_get_ds(type) == NULL) { PyErr_Format(PyExc_TypeError, "Dataset %s not found", type); FreeAll(); @@ -879,7 +879,7 @@ static PyObject *Notification_dispatch(Notification *self, PyObject *args, PyObj int severity = self->severity; char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL; char *message = NULL; - + static char *kwlist[] = {"type", "message", "plugin_instance", "type_instance", "plugin", "host", "time", "severity", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etetetetetetdi", kwlist, @@ -927,11 +927,11 @@ static PyObject *Notification_dispatch(Notification *self, PyObject *args, PyObj static PyObject *Notification_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { Notification *self; - + self = (Notification *) PluginData_new(type, args, kwds); if (self == NULL) return NULL; - + self->message[0] = 0; self->severity = 0; return (PyObject *) self; @@ -940,7 +940,7 @@ static PyObject *Notification_new(PyTypeObject *type, PyObject *args, PyObject * static int Notification_setstring(PyObject *self, PyObject *value, void *data) { char *old; const char *new; - + if (value == NULL) { PyErr_SetString(PyExc_TypeError, "Cannot delete this attribute"); return -1; @@ -961,17 +961,17 @@ static PyObject *Notification_repr(PyObject *s) { PyObject *ret, *tmp; static PyObject *l_severity = NULL, *l_message = NULL, *l_closing = NULL; Notification *self = (Notification *) s; - + if (l_severity == NULL) l_severity = cpy_string_to_unicode_or_bytes(",severity="); if (l_message == NULL) l_message = cpy_string_to_unicode_or_bytes(",message="); if (l_closing == NULL) l_closing = cpy_string_to_unicode_or_bytes(")"); - + if (l_severity == NULL || l_message == NULL || l_closing == NULL) return NULL; - + ret = cpy_common_repr(s); if (self->severity != 0) { CPY_STRCAT(&ret, l_severity); diff --git a/src/rrdcached.c b/src/rrdcached.c index 5d98de8e..3a6c9851 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -95,7 +95,7 @@ static int value_list_to_string (char *buffer, int buffer_len, status = ssnprintf (buffer + offset, buffer_len - offset, ":%llu", vl->values[i].counter); } - else if (ds->ds[i].type == DS_TYPE_GAUGE) + else if (ds->ds[i].type == DS_TYPE_GAUGE) { status = ssnprintf (buffer + offset, buffer_len - offset, ":%f", vl->values[i].gauge); @@ -107,7 +107,7 @@ static int value_list_to_string (char *buffer, int buffer_len, else /* if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */ { status = ssnprintf (buffer + offset, buffer_len - offset, ":%"PRIu64, vl->values[i].absolute); - + } if ((status < 1) || (status >= (buffer_len - offset))) diff --git a/src/rrdtool.c b/src/rrdtool.c index 6b44f67e..b45f8d99 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -442,7 +442,7 @@ static void *rrd_queue_thread (void __attribute__((unused)) *data) } /* Update `tv_next_update' */ - if (write_rate > 0.0) + if (write_rate > 0.0) { gettimeofday (&tv_now, /* timezone = */ NULL); tv_next_update.tv_sec = tv_now.tv_sec; @@ -522,7 +522,7 @@ static int rrd_queue_dequeue (const char *filename, { if (strcmp (this->filename, filename) == 0) break; - + prev = this; this = this->next; } @@ -607,7 +607,7 @@ static void rrd_cache_flush (cdtime_t timeout) } } /* while (c_avl_iterator_next) */ c_avl_iterator_destroy (iter); - + for (i = 0; i < keys_num; i++) { if (c_avl_remove (cache, keys[i], (void *) &key, (void *) &rc) != 0) @@ -1087,7 +1087,7 @@ static int rrd_config (const char *key, const char *value) while ((ptr = strtok_r (dummy, ", \t", &saveptr)) != NULL) { dummy = NULL; - + tmp_alloc = realloc (rrdcreate_config.timespans, sizeof (int) * (rrdcreate_config.timespans_num + 1)); if (tmp_alloc == NULL) diff --git a/src/sensors.c b/src/sensors.c index 6125d0bc..852b41c1 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -18,7 +18,7 @@ * * Authors: * Florian octo Forster - * + * * Lubos Stanek Wed Oct 27, 2006 * - config ExtendedSensorNaming option * - precise sensor feature selection (chip-bus-address/type-feature) @@ -76,7 +76,7 @@ struct sensors_labeltypes_s typedef struct sensors_labeltypes_s sensors_labeltypes_t; /* finite list of known labels extracted from lm_sensors */ -static sensors_labeltypes_t known_features[] = +static sensors_labeltypes_t known_features[] = { { "fan1", SENSOR_TYPE_FANSPEED }, { "fan2", SENSOR_TYPE_FANSPEED }, @@ -289,7 +289,7 @@ static int sensors_load_conf (void) FILE *fh = NULL; featurelist_t *last_feature = NULL; - + const sensors_chip_name *chip; int chip_num; diff --git a/src/teamspeak2.c b/src/teamspeak2.c index 263863b9..41f58e5c 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -139,7 +139,7 @@ static void tss2_submit_gauge (const char *plugin_instance, if (type_instance != NULL) sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); - + plugin_dispatch_values (&vl); } /* void tss2_submit_gauge */ @@ -351,7 +351,7 @@ static int tss2_receive_line (FILE *fh, char *buffer, int buffer_size) * Receive a single line from the given file object */ char *temp; - + /* * fgets is blocking but much easier then doing anything else * TODO: Non-blocking Version would be safer @@ -434,7 +434,7 @@ static int tss2_vserver_gapl (FILE *read_fh, FILE *write_fh, char buffer[4096]; char *value; char *endptr = NULL; - + status = tss2_receive_line (read_fh, buffer, sizeof (buffer)); if (status != 0) { @@ -445,7 +445,7 @@ static int tss2_vserver_gapl (FILE *read_fh, FILE *write_fh, return (-1); } buffer[sizeof (buffer) - 1] = 0; - + if (strncmp ("average_packet_loss=", buffer, strlen ("average_packet_loss=")) == 0) { @@ -461,9 +461,9 @@ static int tss2_vserver_gapl (FILE *read_fh, FILE *write_fh, } value++; } - + value = &buffer[20]; - + packet_loss = strtod (value, &endptr); if (value == endptr) { @@ -488,7 +488,7 @@ static int tss2_vserver_gapl (FILE *read_fh, FILE *write_fh, buffer); } } - + *ret_value = packet_loss; return (0); } /* int tss2_vserver_gapl */ @@ -558,7 +558,7 @@ static int tss2_read_vserver (vserver_list_t *vserver) char *key; char *value; char *endptr = NULL; - + /* Read one line of the server's answer */ status = tss2_receive_line (read_fh, buffer, sizeof (buffer)); if (status != 0) @@ -753,7 +753,7 @@ static int tss2_config (const char *key, const char *value) { /* Server variable found */ int status; - + status = tss2_add_vserver (atoi (value)); if (status != 0) return (1); @@ -803,7 +803,7 @@ static int tss2_read (void) continue; } } - + if (success == 0) return (-1); return (0); @@ -832,7 +832,7 @@ static int tss2_shutdown(void) /* Get rid of the configuration */ sfree (config_host); sfree (config_port); - + return (0); } /* int tss2_shutdown */ diff --git a/src/users.c b/src/users.c index 139c9765..a4ee4ef7 100644 --- a/src/users.c +++ b/src/users.c @@ -3,7 +3,7 @@ * Copyright (C) 2005-2007 Sebastian Harl * Copyright (C) 2005 Niki W. Waibel * Copyright (C) 2005-2007 Florian octo Forster - * Copyright (C) 2008 Oleg King + * Copyright (C) 2008 Oleg King * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -77,7 +77,7 @@ static int users_read (void) users_submit (users); /* #endif HAVE_GETUTXENT */ - + #elif HAVE_GETUTENT unsigned int users = 0; struct utmp *entry = NULL; @@ -106,7 +106,7 @@ static int users_read (void) us = sg_get_user_stats (); # endif if (us == NULL) - return (-1); + return (-1); users_submit ((gauge_t) # if HAVE_LIBSTATGRAB_0_90 diff --git a/src/utils_db_query.h b/src/utils_db_query.h index 08b10bda..8586adb2 100644 --- a/src/utils_db_query.h +++ b/src/utils_db_query.h @@ -41,7 +41,7 @@ typedef struct udb_query_preparation_area_s udb_query_preparation_area_t; typedef int (*udb_query_create_callback_t) (udb_query_t *q, oconfig_item_t *ci); -/* +/* * Public functions */ int udb_query_create (udb_query_t ***ret_query_list, @@ -62,7 +62,7 @@ const char *udb_query_get_statement (udb_query_t *q); void udb_query_set_user_data (udb_query_t *q, void *user_data); void *udb_query_get_user_data (udb_query_t *q); -/* +/* * udb_query_check_version * * Returns 0 if the query is NOT suitable for `version' and >0 if the diff --git a/src/utils_dns.h b/src/utils_dns.h index ef7de0a6..5c547c61 100644 --- a/src/utils_dns.h +++ b/src/utils_dns.h @@ -3,10 +3,10 @@ * Copyright (C) 2006 Florian octo Forster * Copyright (C) 2002 The Measurement Factory, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, diff --git a/src/utils_parse_option.c b/src/utils_parse_option.c index 7f06f295..69da0403 100644 --- a/src/utils_parse_option.c +++ b/src/utils_parse_option.c @@ -92,7 +92,7 @@ int parse_string (char **ret_buffer, char **ret_string) buffer++; } } - + /* Eat up trailing spaces */ while (isspace ((int) *buffer)) buffer++; diff --git a/src/utils_vl_lookup.c b/src/utils_vl_lookup.c index d3eeab3c..a0237841 100644 --- a/src/utils_vl_lookup.c +++ b/src/utils_vl_lookup.c @@ -157,7 +157,7 @@ static int lu_copy_ident_to_match_part (part_match_t *match_part, /* {{{ */ assert (sizeof (match_part->str) > len); /* strip trailing slash */ match_part->str[len - 2] = 0; - + status = regcomp (&match_part->regex, match_part->str, /* flags = */ REG_EXTENDED); if (status != 0) @@ -169,7 +169,7 @@ static int lu_copy_ident_to_match_part (part_match_t *match_part, /* {{{ */ return (EINVAL); } match_part->is_regex = 1; - + return (0); } /* }}} int lu_copy_ident_to_match_part */ @@ -336,7 +336,7 @@ static int lu_handle_user_class_list (lookup_t *obj, /* {{{ */ { user_class_list_t *ptr; int retval = 0; - + for (ptr = user_class_list; ptr != NULL; ptr = ptr->next) { int status; @@ -401,7 +401,7 @@ static by_type_entry_t *lu_search_by_type (lookup_t *obj, /* {{{ */ sfree (type_copy); return (NULL); } - + return (by_type); } /* }}} by_type_entry_t *lu_search_by_type */ @@ -507,7 +507,7 @@ static void lu_destroy_user_class_list (lookup_t *obj, /* {{{ */ static void lu_destroy_by_type (lookup_t *obj, /* {{{ */ by_type_entry_t *by_type) { - + while (42) { char *plugin = NULL; @@ -651,6 +651,6 @@ int lookup_search (lookup_t *obj, /* {{{ */ return (status); retval += status; } - + return (retval); } /* }}} lookup_search */ diff --git a/src/utils_vl_lookup_test.c b/src/utils_vl_lookup_test.c index 6d23c8c5..2d541eea 100644 --- a/src/utils_vl_lookup_test.c +++ b/src/utils_vl_lookup_test.c @@ -68,7 +68,7 @@ static void *lookup_class_callback (data_set_t const *ds, assert (expect_new_obj); memcpy (&last_class_ident, class, sizeof (last_class_ident)); - + obj = malloc (sizeof (*obj)); strncpy (obj->host, vl->host, sizeof (obj->host)); strncpy (obj->plugin, vl->plugin, sizeof (obj->plugin)); diff --git a/src/uuid.c b/src/uuid.c index 2df60639..50882179 100644 --- a/src/uuid.c +++ b/src/uuid.c @@ -100,7 +100,7 @@ uuid_get_from_dmidecode(void) if (!dmidecode) { return NULL; } - + uuid = uuid_parse_dmidecode(dmidecode); pclose(dmidecode); diff --git a/src/vmem.c b/src/vmem.c index 7bb0433c..f5017068 100644 --- a/src/vmem.c +++ b/src/vmem.c @@ -147,7 +147,7 @@ static int vmem_read (void) if (fields[1] == endptr) continue; - /* + /* * Number of pages * * The total number of {inst} pages, e. g dirty pages. @@ -167,7 +167,7 @@ static int vmem_read (void) } } - /* + /* * Page in and page outs. For memory and swap. */ else if (strcmp ("pgpgin", key) == 0) diff --git a/src/vserver.c b/src/vserver.c index 6c09f439..1d957eb3 100644 --- a/src/vserver.c +++ b/src/vserver.c @@ -146,7 +146,7 @@ static int vserver_read (void) if (proc == NULL) { char errbuf[1024]; - ERROR ("vserver plugin: fopen (%s): %s", PROCDIR, + ERROR ("vserver plugin: fopen (%s): %s", PROCDIR, sstrerror (errno, errbuf, sizeof (errbuf))); return (-1); } @@ -185,7 +185,7 @@ static int vserver_read (void) len = ssnprintf (file, sizeof (file), PROCDIR "/%s", dent->d_name); if ((len < 0) || (len >= BUFSIZE)) continue; - + status = stat (file, &statbuf); if (status != 0) { @@ -194,7 +194,7 @@ static int vserver_read (void) file, sstrerror (errno, errbuf, sizeof (errbuf))); continue; } - + if (!S_ISDIR (statbuf.st_mode)) continue; diff --git a/src/wireless.c b/src/wireless.c index f2a3cf58..8445af22 100644 --- a/src/wireless.c +++ b/src/wireless.c @@ -41,7 +41,7 @@ static double wireless_dbm_to_watt (double dbm) /* * dbm = 10 * log_{10} (1000 * power / W) - * power = 10^(dbm/10) * W/1000 + * power = 10^(dbm/10) * W/1000 */ watt = pow (10.0, (dbm / 10.0)) / 1000.0; @@ -88,7 +88,7 @@ static int wireless_read (void) double quality; double power; double noise; - + char *fields[8]; int numfields; -- 2.11.0