From 4af2afc84a90fe37e4988fca08ea79a6343c6b94 Mon Sep 17 00:00:00 2001 From: =?utf8?q?F=E1=B4=80=CA=99=C9=AA=E1=B4=87=C9=B4=20W=E1=B4=87=CA=80?= =?utf8?q?=C9=B4=CA=9F=C9=AA?= Date: Mon, 24 Jun 2019 10:37:40 +0200 Subject: [PATCH] clang-format --- src/barometer.c | 2 +- src/daemon/configfile.c | 21 +++++++++++---------- src/load.c | 12 +++++++----- src/openvpn.c | 15 +++++++++------ src/syslog.c | 5 +++-- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/barometer.c b/src/barometer.c index 6e8eacda..fd733b49 100644 --- a/src/barometer.c +++ b/src/barometer.c @@ -1310,7 +1310,7 @@ static int collectd_barometer_config(const char *key, const char *value) { int normalize_tmp = atoi(value); if (normalize_tmp < 0 || normalize_tmp > 2) { ERROR("barometer: collectd_barometer_config: invalid normalization: %d", - normalize_tmp); + normalize_tmp); return 1; } config_normalize = normalize_tmp; diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index cc230912..5cf8ac1f 100644 --- a/src/daemon/configfile.c +++ b/src/daemon/configfile.c @@ -267,7 +267,8 @@ static int dispatch_loadplugin(oconfig_item_t *ci) { /* default to the global interval set before loading this plugin */ plugin_ctx_t ctx = { - .interval = cf_get_default_interval(), .name = strdup(name), + .interval = cf_get_default_interval(), + .name = strdup(name), }; if (ctx.name == NULL) return ENOMEM; @@ -413,10 +414,11 @@ static int dispatch_block_plugin(oconfig_item_t *ci) { /* Hm, no complex plugin found. Dispatch the values one by one */ for (int i = 0, ret = 0; i < ci->children_num; i++) { if (ci->children[i].children == NULL) { - oconfig_item_t *child = ci -> children + i; + oconfig_item_t *child = ci->children + i; ret = dispatch_value_plugin(name, child); if (ret != 0) { - ERROR("Plugin %s failed to handle option %s, return code: %i", name, child -> key, ret); + ERROR("Plugin %s failed to handle option %s, return code: %i", name, + child->key, ret); return ret; } } else { @@ -478,9 +480,9 @@ static int cf_ci_replace_child(oconfig_item_t *dst, oconfig_item_t *src, return 0; } - temp = realloc(dst->children, - sizeof(oconfig_item_t) * - (dst->children_num + src->children_num - 1)); + temp = + realloc(dst->children, sizeof(oconfig_item_t) * + (dst->children_num + src->children_num - 1)); if (temp == NULL) { ERROR("configfile: realloc failed."); return -1; @@ -519,9 +521,8 @@ static int cf_ci_append_children(oconfig_item_t *dst, oconfig_item_t *src) { if ((src == NULL) || (src->children_num == 0)) return 0; - temp = - realloc(dst->children, - sizeof(oconfig_item_t) * (dst->children_num + src->children_num)); + temp = realloc(dst->children, sizeof(oconfig_item_t) * + (dst->children_num + src->children_num)); if (temp == NULL) { ERROR("configfile: realloc failed."); return -1; @@ -809,7 +810,7 @@ static oconfig_item_t *cf_read_generic(const char *path, const char *pattern, return root; } /* oconfig_item_t *cf_read_generic */ -/* #endif HAVE_WORDEXP_H */ + /* #endif HAVE_WORDEXP_H */ #else /* if !HAVE_WORDEXP_H */ static oconfig_item_t *cf_read_generic(const char *path, const char *pattern, diff --git a/src/load.c b/src/load.c index 1adc6218..a94ee960 100644 --- a/src/load.c +++ b/src/load.c @@ -91,7 +91,9 @@ static void load_submit(gauge_t snum, gauge_t mnum, gauge_t lnum) { value_list_t vl = VALUE_LIST_INIT; value_t values[] = { - {.gauge = snum}, {.gauge = mnum}, {.gauge = lnum}, + {.gauge = snum}, + {.gauge = mnum}, + {.gauge = lnum}, }; vl.values = values; @@ -116,7 +118,7 @@ static int load_read(void) { else { WARNING("load: getloadavg failed: %s", STRERRNO); } -/* #endif HAVE_GETLOADAVG */ + /* #endif HAVE_GETLOADAVG */ #elif defined(KERNEL_LINUX) gauge_t snum, mnum, lnum; @@ -151,7 +153,7 @@ static int load_read(void) { lnum = atof(fields[2]); load_submit(snum, mnum, lnum); -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_LIBSTATGRAB gauge_t snum, mnum, lnum; @@ -164,7 +166,7 @@ static int load_read(void) { mnum = ls->min5; lnum = ls->min15; load_submit(snum, mnum, lnum); -/* #endif HAVE_LIBSTATGRAB */ + /* #endif HAVE_LIBSTATGRAB */ #elif HAVE_PERFSTAT gauge_t snum, mnum, lnum; @@ -180,7 +182,7 @@ static int load_read(void) { mnum = (float)cputotal.loadavg[1] / (float)(1 << SBITS); lnum = (float)cputotal.loadavg[2] / (float)(1 << SBITS); load_submit(snum, mnum, lnum); -/* #endif HAVE_PERFSTAT */ + /* #endif HAVE_PERFSTAT */ #else #error "No applicable input method." diff --git a/src/openvpn.c b/src/openvpn.c index 10a42592..b0e4bf40 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -139,7 +139,8 @@ static void iostats_submit(const char *pinst, const char *tinst, derive_t rx, derive_t tx) { value_list_t vl = VALUE_LIST_INIT; value_t values[] = { - {.derive = rx}, {.derive = tx}, + {.derive = rx}, + {.derive = tx}, }; /* NOTE ON THE NEW NAMING SCHEMA: @@ -165,7 +166,8 @@ static void compression_submit(const char *pinst, const char *tinst, derive_t uncompressed, derive_t compressed) { value_list_t vl = VALUE_LIST_INIT; value_t values[] = { - {.derive = uncompressed}, {.derive = compressed}, + {.derive = uncompressed}, + {.derive = compressed}, }; vl.values = values; @@ -502,14 +504,15 @@ static int openvpn_config(const char *key, const char *value) { /* callback = */ openvpn_read, /* interval = */ 0, &(user_data_t){ - .data = instance, .free_func = openvpn_free, + .data = instance, + .free_func = openvpn_free, }); if (status == EINVAL) { ERROR("openvpn plugin: status filename \"%s\" " - "already used, please choose a " - "different one.", - status_name); + "already used, please choose a " + "different one.", + status_name); return -1; } diff --git a/src/syslog.c b/src/syslog.c index e8c4be56..d3be5c95 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -41,7 +41,8 @@ static int log_level = LOG_INFO; static int notif_severity; static const char *config_keys[] = { - "LogLevel", "NotifyLevel", + "LogLevel", + "NotifyLevel", }; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); @@ -57,7 +58,7 @@ static int sl_config(const char *key, const char *value) { notif_severity = parse_notif_severity(value); if (notif_severity < 0) ERROR("syslog: invalid notification severity [%s]", value); - return 1; + return 1; } return 0; -- 2.11.0