From: Ruben Kerkhof Date: Sun, 13 May 2018 17:30:31 +0000 (+0200) Subject: clang-format X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=029b489b237a8785c539f85d4840a49ba6743603;p=collectd.git clang-format --- diff --git a/src/aggregation.c b/src/aggregation.c index 8cd91d4f..64c641f8 100644 --- a/src/aggregation.c +++ b/src/aggregation.c @@ -396,9 +396,10 @@ static int agg_instance_read(agg_instance_t *inst, cdtime_t t) /* {{{ */ READ_FUNC(average, (inst->sum / ((gauge_t)inst->num))); READ_FUNC(min, inst->min); READ_FUNC(max, inst->max); - READ_FUNC(stddev, sqrt((((gauge_t)inst->num) * inst->squares_sum) - - (inst->sum * inst->sum)) / - ((gauge_t)inst->num)); + READ_FUNC(stddev, + sqrt((((gauge_t)inst->num) * inst->squares_sum) - + (inst->sum * inst->sum)) / + ((gauge_t)inst->num)); } /* Reset internal state. */ diff --git a/src/apache.c b/src/apache.c index 5ebd0441..5c67a388 100644 --- a/src/apache.c +++ b/src/apache.c @@ -224,8 +224,7 @@ static int config_add(oconfig_item_t *ci) { /* callback = */ apache_read_host, /* interval = */ 0, &(user_data_t){ - .data = st, - .free_func = apache_free, + .data = st, .free_func = apache_free, }); } /* int config_add */ diff --git a/src/barometer.c b/src/barometer.c index f21cdafe..6945442c 100644 --- a/src/barometer.c +++ b/src/barometer.c @@ -313,7 +313,7 @@ static double averaging_add_sample(averaging_t *avg, long int sample) { typedef struct temperature_list_s { char *sensor_name; /**< sensor name/reference */ size_t num_values; /**< number of values (usually one) */ - bool initialized; /**< sensor already provides data */ + bool initialized; /**< sensor already provides data */ struct temperature_list_s *next; /**< next in the list */ } temperature_list_t; diff --git a/src/bind.c b/src/bind.c index 7af42696..cc5aa593 100644 --- a/src/bind.c +++ b/src/bind.c @@ -1567,9 +1567,8 @@ static int bind_init(void) /* {{{ */ curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); #ifdef HAVE_CURLOPT_TIMEOUT_MS curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, - (timeout >= 0) - ? (long)timeout - : (long)CDTIME_T_TO_MS(plugin_get_interval())); + (timeout >= 0) ? (long)timeout : (long)CDTIME_T_TO_MS( + plugin_get_interval())); #endif return 0; diff --git a/src/collectd-tg.c b/src/collectd-tg.c index 6c0a8a5b..170df2a6 100644 --- a/src/collectd-tg.c +++ b/src/collectd-tg.c @@ -147,7 +147,8 @@ static int get_boundet_random(int min, int max) /* {{{ */ range = max - min; - return min + ((int)(((double)range) * ((double)random()) / (((double)RAND_MAX) + 1.0))); + return min + ((int)(((double)range) * ((double)random()) / + (((double)RAND_MAX) + 1.0))); } /* }}} int get_boundet_random */ static lcc_value_list_t *create_value_list(void) /* {{{ */ diff --git a/src/daemon/meta_data_test.c b/src/daemon/meta_data_test.c index 99de13d9..ca808364 100644 --- a/src/daemon/meta_data_test.c +++ b/src/daemon/meta_data_test.c @@ -24,9 +24,10 @@ * Florian octo Forster */ -#include "common.h" /* for STATIC_ARRAY_SIZE */ #include "collectd.h" +#include "common.h" /* for STATIC_ARRAY_SIZE */ + #include "meta_data.h" #include "testing.h" diff --git a/src/daemon/utils_cache.h b/src/daemon/utils_cache.h index 34ff7435..7200906d 100644 --- a/src/daemon/utils_cache.h +++ b/src/daemon/utils_cache.h @@ -42,7 +42,8 @@ int uc_update(const data_set_t *ds, const value_list_t *vl); int uc_get_rate_by_name(const char *name, gauge_t **ret_values, size_t *ret_values_num); gauge_t *uc_get_rate(const data_set_t *ds, const value_list_t *vl); -int uc_get_value_by_name(const char *name, value_t **ret_values, size_t *ret_values_num); +int uc_get_value_by_name(const char *name, value_t **ret_values, + size_t *ret_values_num); value_t *uc_get_value(const data_set_t *ds, const value_list_t *vl); size_t uc_get_size(void); diff --git a/src/libcollectdclient/server.c b/src/libcollectdclient/server.c index 1733b61a..1095ebaf 100644 --- a/src/libcollectdclient/server.c +++ b/src/libcollectdclient/server.c @@ -33,6 +33,7 @@ #include "collectd/network_parse.h" /* for lcc_network_parse_options_t */ #include "collectd/server.h" +// clang-format off #include #include #include @@ -42,6 +43,7 @@ #include #include #include +// clang-format on #include #define DEBUG(...) printf(__VA_ARGS__) diff --git a/src/ovs_events.c b/src/ovs_events.c index a302f115..10a0f43e 100644 --- a/src/ovs_events.c +++ b/src/ovs_events.c @@ -66,7 +66,7 @@ typedef struct ovs_events_iface_list_s ovs_events_iface_list_t; /* OVS events configuration data */ struct ovs_events_config_s { - bool send_notification; /* sent notification to collectd? */ + bool send_notification; /* sent notification to collectd? */ char ovs_db_node[OVS_DB_ADDR_NODE_SIZE]; /* OVS DB node */ char ovs_db_serv[OVS_DB_ADDR_SERVICE_SIZE]; /* OVS DB service */ char ovs_db_unix[OVS_DB_ADDR_UNIX_SIZE]; /* OVS DB unix socket path */ @@ -80,7 +80,7 @@ struct ovs_events_ctx_s { ovs_db_t *ovs_db; /* pointer to OVS DB instance */ ovs_events_config_t config; /* plugin config */ char *ovs_db_select_params; /* OVS DB select parameter request */ - bool is_db_available; /* specify whether OVS DB is available */ + bool is_db_available; /* specify whether OVS DB is available */ }; typedef struct ovs_events_ctx_s ovs_events_ctx_t; diff --git a/src/python.c b/src/python.c index 53b3806c..969a4db8 100644 --- a/src/python.c +++ b/src/python.c @@ -703,9 +703,8 @@ static PyObject *cpy_get_dataset(PyObject *self, PyObject *args) { for (size_t i = 0; i < ds->ds_num; ++i) { tuple = PyTuple_New(4); PyTuple_SET_ITEM(tuple, 0, cpy_string_to_unicode_or_bytes(ds->ds[i].name)); - PyTuple_SET_ITEM( - tuple, 1, - cpy_string_to_unicode_or_bytes(DS_TYPE_TO_STRING(ds->ds[i].type))); + PyTuple_SET_ITEM(tuple, 1, cpy_string_to_unicode_or_bytes( + DS_TYPE_TO_STRING(ds->ds[i].type))); PyTuple_SET_ITEM(tuple, 2, float_or_none(ds->ds[i].min)); PyTuple_SET_ITEM(tuple, 3, float_or_none(ds->ds[i].max)); PyList_SET_ITEM(list, i, tuple); @@ -775,8 +774,7 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, register_function(buf, handler, &(user_data_t){ - .data = c, - .free_func = cpy_destroy_user_data, + .data = c, .free_func = cpy_destroy_user_data, }); ++cpy_num_callbacks; @@ -819,8 +817,7 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args, /* group = */ "python", buf, cpy_read_callback, DOUBLE_TO_CDTIME_T(interval), &(user_data_t){ - .data = c, - .free_func = cpy_destroy_user_data, + .data = c, .free_func = cpy_destroy_user_data, }); ++cpy_num_callbacks; return cpy_string_to_unicode_or_bytes(buf); @@ -1200,9 +1197,8 @@ static PyObject *cpy_oconfig_to_pyconfig(oconfig_item_t *ci, PyObject *parent) { values = PyTuple_New(ci->values_num); /* New reference. */ for (int i = 0; i < ci->values_num; ++i) { if (ci->values[i].type == OCONFIG_TYPE_STRING) { - PyTuple_SET_ITEM( - values, i, - cpy_string_to_unicode_or_bytes(ci->values[i].value.string)); + PyTuple_SET_ITEM(values, i, cpy_string_to_unicode_or_bytes( + ci->values[i].value.string)); } else if (ci->values[i].type == OCONFIG_TYPE_NUMBER) { PyTuple_SET_ITEM(values, i, PyFloat_FromDouble(ci->values[i].value.number)); diff --git a/src/pyvalues.c b/src/pyvalues.c index 1aaa3f0a..12c8dde8 100644 --- a/src/pyvalues.c +++ b/src/pyvalues.c @@ -562,7 +562,7 @@ static int cpy_build_meta_generic(PyObject *meta, CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_signed_int, int64_t) \ CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_unsigned_int, uint64_t) \ CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_double, double) \ - CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_boolean, bool) \ + CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_boolean, bool) \ \ static cpy_build_meta_handler_t cpy_##func_prefix = { \ .add_string = cpy_##func_prefix##_add_string, \ diff --git a/src/tail_csv.c b/src/tail_csv.c index 23281136..58e101f6 100644 --- a/src/tail_csv.c +++ b/src/tail_csv.c @@ -121,7 +121,7 @@ static int tcsv_read_metric(instance_definition_t *id, metric_definition_t *md, } static bool tcsv_check_index(ssize_t index, size_t fields_num, - char const *name) { + char const *name) { if (index < 0) return 1; else if (((size_t)index) < fields_num) diff --git a/src/testing.h b/src/testing.h index fed76195..41e2e81e 100644 --- a/src/testing.h +++ b/src/testing.h @@ -56,7 +56,7 @@ static int check_count__ = 0; #define OK1(cond, text) \ do { \ - bool result = (cond); \ + bool result = (cond); \ LOG(result, text); \ if (!result) { \ return -1; \ diff --git a/src/utils_vl_lookup.c b/src/utils_vl_lookup.c index 6d922462..bcde0868 100644 --- a/src/utils_vl_lookup.c +++ b/src/utils_vl_lookup.c @@ -115,7 +115,7 @@ typedef struct by_type_entry_s by_type_entry_t; * Private functions */ static bool lu_part_matches(part_match_t const *match, /* {{{ */ - char const *str) { + char const *str) { if (match->is_regex) { /* Short cut popular catch-all regex. */ if (strcmp(".*", match->str) == 0) diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 6903aa06..e7be797f 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -244,9 +244,8 @@ static int http_handler(void *cls, struct MHD_Connection *connection, char const *accept = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_ACCEPT); - bool want_proto = - (accept != NULL) && - (strstr(accept, "application/vnd.google.protobuf") != NULL); + bool want_proto = (accept != NULL) && + (strstr(accept, "application/vnd.google.protobuf") != NULL); uint8_t scratch[4096] = {0}; ProtobufCBufferSimple simple = PROTOBUF_C_BUFFER_SIMPLE_INIT(scratch);