Code

Run clang-format after removing ssnprintf
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 16 Jul 2017 20:24:54 +0000 (22:24 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 16 Jul 2017 20:24:54 +0000 (22:24 +0200)
Changing ssnprintf to snprintf changed the indentation.

97 files changed:
src/aggregation.c
src/amqp.c
src/apache.c
src/ascent.c
src/battery.c
src/bind.c
src/cgroups.c
src/cpufreq.c
src/csv.c
src/curl.c
src/curl_json.c
src/curl_xml.c
src/daemon/common.c
src/daemon/configfile.c
src/daemon/filter_chain.c
src/daemon/plugin.c
src/dbi.c
src/disk.c
src/dpdkevents.c
src/exec.c
src/gmond.c
src/hugepages.c
src/interface.c
src/ipmi.c
src/iptables.c
src/ipvs.c
src/java.c
src/logfile.c
src/lua.c
src/lvm.c
src/madwifi.c
src/mcelog.c
src/memcached.c
src/mic.c
src/mqtt.c
src/mysql.c
src/netapp.c
src/netlink.c
src/network.c
src/nfs.c
src/nginx.c
src/notify_desktop.c
src/notify_email.c
src/notify_nagios.c
src/ntpd.c
src/olsrd.c
src/openldap.c
src/oracle.c
src/ovs_events.c
src/ovs_stats.c
src/perl.c
src/postgresql.c
src/protocols.c
src/python.c
src/routeros.c
src/rrdcached.c
src/rrdtool.c
src/sensors.c
src/sigrok.c
src/smart.c
src/snmp.c
src/snmp_agent.c
src/statsd.c
src/swap.c
src/syslog.c
src/target_notification.c
src/target_scale.c
src/target_v5upgrade.c
src/tcpconns.c
src/teamspeak2.c
src/thermal.c
src/threshold.c
src/turbostat.c
src/utils_cmd_putval.c
src/utils_cmds.c
src/utils_dpdk.c
src/utils_format_graphite.c
src/utils_format_json.c
src/utils_format_kairosdb.c
src/utils_latency_config.c
src/utils_lua.c
src/utils_mount.c
src/utils_ovs.c
src/utils_rrdcreate.c
src/utils_tail_match.c
src/varnish.c
src/virt.c
src/virt_test.c
src/write_graphite.c
src/write_http.c
src/write_kafka.c
src/write_prometheus.c
src/write_redis.c
src/write_riemann.c
src/write_sensu.c
src/write_tsdb.c
src/zfs_arc.c

index 493f17e3ae641c881d0e112788f95c4b3c193403..5fea279c16217d818d09afa4a967419ea10b3d05 100644 (file)
@@ -200,17 +200,15 @@ static int agg_instance_create_name(agg_instance_t *inst, /* {{{ */
       sstrncpy(inst->ident.plugin_instance, AGG_FUNC_PLACEHOLDER,
                sizeof(inst->ident.plugin_instance));
     else if (strcmp("", tmp_plugin) != 0)
-      snprintf(inst->ident.plugin_instance,
-                sizeof(inst->ident.plugin_instance), "%s-%s", tmp_plugin,
-                AGG_FUNC_PLACEHOLDER);
+      snprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
+               "%s-%s", tmp_plugin, AGG_FUNC_PLACEHOLDER);
     else if (strcmp("", tmp_plugin_instance) != 0)
-      snprintf(inst->ident.plugin_instance,
-                sizeof(inst->ident.plugin_instance), "%s-%s",
-                tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
+      snprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
+               "%s-%s", tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
     else
-      snprintf(inst->ident.plugin_instance,
-                sizeof(inst->ident.plugin_instance), "%s-%s-%s", tmp_plugin,
-                tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
+      snprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
+               "%s-%s-%s", tmp_plugin, tmp_plugin_instance,
+               AGG_FUNC_PLACEHOLDER);
   }
 
   /* Type */
index 73bc1a2961e22d43dcf4b60299ba86b254588517..467b7ff46041f76d618c0308eee50ce77cf6353e 100644 (file)
@@ -218,17 +218,17 @@ static char *camqp_strerror(camqp_config_t *conf, /* {{{ */
       amqp_connection_close_t *m = r.reply.decoded;
       char *tmp = camqp_bytes_cstring(&m->reply_text);
       snprintf(buffer, buffer_size, "Server connection error %d: %s",
-                m->reply_code, tmp);
+               m->reply_code, tmp);
       sfree(tmp);
     } else if (r.reply.id == AMQP_CHANNEL_CLOSE_METHOD) {
       amqp_channel_close_t *m = r.reply.decoded;
       char *tmp = camqp_bytes_cstring(&m->reply_text);
       snprintf(buffer, buffer_size, "Server channel error %d: %s",
-                m->reply_code, tmp);
+               m->reply_code, tmp);
       sfree(tmp);
     } else {
       snprintf(buffer, buffer_size, "Server error method %#" PRIx32,
-                r.reply.id);
+               r.reply.id);
     }
     break;
 
@@ -759,8 +759,8 @@ static int camqp_write(const data_set_t *ds, const value_list_t *vl, /* {{{ */
     sstrncpy(routing_key, conf->routing_key, sizeof(routing_key));
   } else {
     snprintf(routing_key, sizeof(routing_key), "collectd/%s/%s/%s/%s/%s",
-              vl->host, vl->plugin, vl->plugin_instance, vl->type,
-              vl->type_instance);
+             vl->host, vl->plugin, vl->plugin_instance, vl->type,
+             vl->type_instance);
 
     /* Switch slashes (the only character forbidden by collectd) and dots
      * (the separation character used by AMQP). */
index a3630800a62d2efaf4aa882eab8100d49fe342e1..2da59e7b5297817691c6b4c86a1d70f21785c50f 100644 (file)
@@ -220,16 +220,17 @@ static int config_add(oconfig_item_t *ci) {
     char callback_name[3 * DATA_MAX_NAME_LEN];
 
     snprintf(callback_name, sizeof(callback_name), "apache/%s/%s",
-              (st->host != NULL) ? st->host : hostname_g,
-              (st->name != NULL) ? st->name : "default");
+             (st->host != NULL) ? st->host : hostname_g,
+             (st->name != NULL) ? st->name : "default");
 
     status = plugin_register_complex_read(
         /* group = */ NULL,
         /* name      = */ callback_name,
         /* callback  = */ apache_read_host,
-        /* interval  = */ 0, &(user_data_t){
-                                 .data = st, .free_func = apache_free,
-                             });
+        /* interval  = */ 0,
+        &(user_data_t){
+            .data = st, .free_func = apache_free,
+        });
   }
 
   if (status != 0) {
@@ -314,7 +315,7 @@ static int init_host(apache_t *st) /* {{{ */
     int status;
 
     status = snprintf(credentials, sizeof(credentials), "%s:%s", st->user,
-                       (st->pass == NULL) ? "" : st->pass);
+                      (st->pass == NULL) ? "" : st->pass);
     if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
       ERROR("apache plugin: init_host: Returning an error "
             "because the credentials have been "
index 678a4a152fcc97bde1620681dc12a27cc1f00654..174a2118e7c2ba4aaa823b10c6f216cc4cc0ac6b 100644 (file)
@@ -500,7 +500,7 @@ static int ascent_init(void) /* {{{ */
     int status;
 
     status = snprintf(credentials, sizeof(credentials), "%s:%s", user,
-                       (pass == NULL) ? "" : pass);
+                      (pass == NULL) ? "" : pass);
     if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
       ERROR("ascent plugin: ascent_init: Returning an error because the "
             "credentials have been truncated.");
index ba08aa695b4b55cebdb5499e3208bff141096065..b6dea0f3f14920e9b4b186d371f98002e11c6a27 100644 (file)
@@ -347,8 +347,7 @@ static int sysfs_file_to_buffer(char const *dir, /* {{{ */
   char filename[PATH_MAX];
   int status;
 
-  snprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply,
-            basename);
+  snprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply, basename);
 
   status = (int)read_file_contents(filename, buffer, buffer_size - 1);
   if (status < 0)
index dc7916a874e1c990d47cb8cb87c716e13235da7e..49fb4d7fe0d7fba1cd442cda411b585ca9dbbc0c 100644 (file)
@@ -737,8 +737,8 @@ static int bind_xml_stats_handle_zone(int version, xmlDoc *doc, /* {{{ */
                                          nsstats_translation_table_length,
                                          plugin_instance};
 
-    snprintf(plugin_instance, sizeof(plugin_instance), "%s-zone-%s",
-              view->name, zone_name);
+    snprintf(plugin_instance, sizeof(plugin_instance), "%s-zone-%s", view->name,
+             zone_name);
 
     if (version == 3) {
       list_info_ptr_t list_info = {plugin_instance,
@@ -868,8 +868,7 @@ static int bind_xml_stats_handle_view(int version, xmlDoc *doc, /* {{{ */
     list_info_ptr_t list_info = {plugin_instance,
                                  /* type = */ "dns_qtype"};
 
-    snprintf(plugin_instance, sizeof(plugin_instance), "%s-qtypes",
-              view->name);
+    snprintf(plugin_instance, sizeof(plugin_instance), "%s-qtypes", view->name);
     if (version == 3) {
       bind_parse_generic_name_attr_value_list(
           /* xpath = */ "counters[@type='resqtype']",
@@ -892,7 +891,7 @@ static int bind_xml_stats_handle_view(int version, xmlDoc *doc, /* {{{ */
                                          plugin_instance};
 
     snprintf(plugin_instance, sizeof(plugin_instance), "%s-resolver_stats",
-              view->name);
+             view->name);
     if (version == 3) {
       bind_parse_generic_name_attr_value_list(
           "counters[@type='resstats']",
@@ -915,7 +914,7 @@ static int bind_xml_stats_handle_view(int version, xmlDoc *doc, /* {{{ */
                                  /* type = */ "dns_qtype_cached"};
 
     snprintf(plugin_instance, sizeof(plugin_instance), "%s-cache_rr_sets",
-              view->name);
+             view->name);
 
     bind_parse_generic_name_value(/* xpath = */ "cache/rrset",
                                   /* callback = */ bind_xml_list_callback,
index 073bf4f3ec061c94d1bf3850191769dc1b919c4b..18e489d044262862233100f68fc8fe20a46e657c 100644 (file)
@@ -76,7 +76,7 @@ static int read_cpuacct_procs(const char *dirname, char const *cgroup_name,
     return 0;
 
   snprintf(abs_path, sizeof(abs_path), "%s/%s/cpuacct.stat", dirname,
-            cgroup_name);
+           cgroup_name);
   fh = fopen(abs_path, "r");
   if (fh == NULL) {
     char errbuf[1024];
index f7865b3aa6b80786154e23af5ce1025c473dc22c..0139947e57527d76bba5353fd132c86a6c5d9f65 100644 (file)
@@ -35,9 +35,9 @@ static int cpufreq_init(void) {
 
   while (1) {
     status = snprintf(filename, sizeof(filename),
-                       "/sys/devices/system/cpu/cpu%d/cpufreq/"
-                       "scaling_cur_freq",
-                       num_cpu);
+                      "/sys/devices/system/cpu/cpu%d/cpufreq/"
+                      "scaling_cur_freq",
+                      num_cpu);
     if ((status < 1) || ((unsigned int)status >= sizeof(filename)))
       break;
 
@@ -71,7 +71,7 @@ static int cpufreq_read(void) {
   for (int i = 0; i < num_cpu; i++) {
     char filename[PATH_MAX];
     snprintf(filename, sizeof(filename),
-              "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", i);
+             "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", i);
 
     value_t v;
     if (parse_value_file(filename, &v, DS_TYPE_GAUGE) != 0) {
index 7d56c89236fb9e92a1f641dca7cbe2c06a83c2eb..debe095327ecf57458ddf9aee59bc48e2f8094ff 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
@@ -63,7 +63,7 @@ static int value_list_to_string(char *buffer, int buffer_len,
 
     if (ds->ds[i].type == DS_TYPE_GAUGE) {
       status = snprintf(buffer + offset, buffer_len - offset, ",%lf",
-                         vl->values[i].gauge);
+                        vl->values[i].gauge);
     } else if (store_rates != 0) {
       if (rates == NULL)
         rates = uc_get_rate(ds, vl);
@@ -72,17 +72,16 @@ static int value_list_to_string(char *buffer, int buffer_len,
                 "uc_get_rate failed.");
         return -1;
       }
-      status =
-          snprintf(buffer + offset, buffer_len - offset, ",%lf", rates[i]);
+      status = snprintf(buffer + offset, buffer_len - offset, ",%lf", rates[i]);
     } else if (ds->ds[i].type == DS_TYPE_COUNTER) {
       status = snprintf(buffer + offset, buffer_len - offset, ",%llu",
-                         vl->values[i].counter);
+                        vl->values[i].counter);
     } else if (ds->ds[i].type == DS_TYPE_DERIVE) {
       status = snprintf(buffer + offset, buffer_len - offset, ",%" PRIi64,
-                         vl->values[i].derive);
+                        vl->values[i].derive);
     } else if (ds->ds[i].type == DS_TYPE_ABSOLUTE) {
       status = snprintf(buffer + offset, buffer_len - offset, ",%" PRIu64,
-                         vl->values[i].absolute);
+                        vl->values[i].absolute);
     }
 
     if ((status < 1) || (status >= (buffer_len - offset))) {
index f9a94428724503ed9c6ae3760844b49c8ffdecbf..ddd98250513c19e5d01c1c1535145c7d974ddb35 100644 (file)
@@ -370,7 +370,7 @@ static int cc_page_init_curl(web_page_t *wp) /* {{{ */
     }
 
     snprintf(wp->credentials, credentials_size, "%s:%s", wp->user,
-              (wp->pass == NULL) ? "" : wp->pass);
+             (wp->pass == NULL) ? "" : wp->pass);
     curl_easy_setopt(wp->curl, CURLOPT_USERPWD, wp->credentials);
 #endif
 
index bf37cf9a49a717ae66d09cea1c31a334896d0060..4803948d66ef48bbf3e4a518e8fd5edea580ed64 100644 (file)
@@ -601,7 +601,7 @@ static int cj_init_curl(cj_t *db) /* {{{ */
     }
 
     snprintf(db->credentials, credentials_size, "%s:%s", db->user,
-              (db->pass == NULL) ? "" : db->pass);
+             (db->pass == NULL) ? "" : db->pass);
     curl_easy_setopt(db->curl, CURLOPT_USERPWD, db->credentials);
 #endif
 
@@ -801,7 +801,7 @@ static void cj_submit_impl(cj_t *db, cj_key_t *key, value_t *value) /* {{{ */
     int len = 0;
     for (int i = 0; i < db->depth; i++)
       len += snprintf(vl.type_instance + len, sizeof(vl.type_instance) - len,
-                       i ? "-%s" : "%s", db->state[i + 1].name);
+                      i ? "-%s" : "%s", db->state[i + 1].name);
   } else
     sstrncpy(vl.type_instance, key->instance, sizeof(vl.type_instance));
 
index 8973a5ba7ea9ca0b7230e709d570b2df28c3ab3f..8eb99811e34044b2d65f0c6f947b6ea38e5801e9 100644 (file)
@@ -369,7 +369,7 @@ static int cx_handle_all_value_xpaths(xmlXPathContextPtr xpath_ctx, /* {{{ */
     status = cx_handle_single_value_xpath(xpath_ctx, xpath, ds, vl, i);
     if (status != 0)
       return -1; /* An error has been printed. */
-  }                /* for (i = 0; i < xpath->values_len; i++) */
+  }              /* for (i = 0; i < xpath->values_len; i++) */
 
   plugin_dispatch_values(vl);
   vl->values = NULL;
@@ -442,7 +442,7 @@ static int cx_handle_instance_xpath(xmlXPathContextPtr xpath_ctx, /* {{{ */
     if (instance_node != NULL) {
       char *node_value = (char *)xmlNodeGetContent(instance_node->nodeTab[0]);
       snprintf(vl->type_instance, sizeof(vl->type_instance), "%s%s",
-                xpath->instance_prefix, node_value);
+               xpath->instance_prefix, node_value);
       sfree(node_value);
     } else
       sstrncpy(vl->type_instance, xpath->instance_prefix,
@@ -840,7 +840,7 @@ static int cx_init_curl(cx_t *db) /* {{{ */
     }
 
     snprintf(db->credentials, credentials_size, "%s:%s", db->user,
-              (db->pass == NULL) ? "" : db->pass);
+             (db->pass == NULL) ? "" : db->pass);
     curl_easy_setopt(db->curl, CURLOPT_USERPWD, db->credentials);
 #endif
 
index 31daa37958f46ae22d70f44f68a73ea4fdc1b4d0..3ae61d8592e5df6b3f42986f0e1131ef5682ace3 100644 (file)
@@ -180,8 +180,8 @@ char *sstrerror(int errnum, char *buf, size_t buflen) {
 #else
   if (strerror_r(errnum, buf, buflen) != 0) {
     snprintf(buf, buflen, "Error #%i; "
-                           "Additionally, strerror_r failed.",
-              errnum);
+                          "Additionally, strerror_r failed.",
+             errnum);
   }
 #endif /* STRERROR_R_CHAR_P */
 
index 7d8c7e779349ee8f92ceb0d40ecef571799b4aa8..0d295c1cbaf476d36682bef152457b19641ee599 100644 (file)
@@ -307,11 +307,11 @@ static int dispatch_value_plugin(const char *plugin, oconfig_item_t *ci) {
       status =
           snprintf(buffer_ptr, buffer_free, " %s", ci->values[i].value.string);
     else if (ci->values[i].type == OCONFIG_TYPE_NUMBER)
-      status = snprintf(buffer_ptr, buffer_free, " %lf",
-                         ci->values[i].value.number);
+      status =
+          snprintf(buffer_ptr, buffer_free, " %lf", ci->values[i].value.number);
     else if (ci->values[i].type == OCONFIG_TYPE_BOOLEAN)
       status = snprintf(buffer_ptr, buffer_free, " %s",
-                         ci->values[i].value.boolean ? "true" : "false");
+                        ci->values[i].value.boolean ? "true" : "false");
 
     if ((status < 0) || (status >= buffer_free))
       return -1;
index 77db7969cfe0142d930d57c9a64e71a377c46ef8..1352f5b39735812c16a16733c96722f312c1ba39 100644 (file)
@@ -344,7 +344,7 @@ static int fc_config_add_rule(fc_chain_t *chain, /* {{{ */
   if (ci->values_num == 1) {
     sstrncpy(rule->name, ci->values[0].value.string, sizeof(rule->name));
     snprintf(rule_name, sizeof(rule_name), "Rule \"%s\"",
-              ci->values[0].value.string);
+             ci->values[0].value.string);
   }
 
   for (int i = 0; i < ci->children_num; i++) {
index 6ae8ffb81fda247309ac31b3863da9f36de6c0d2..0451e8a757665db7b501fcc98bdd2db18b22c88a 100644 (file)
@@ -401,12 +401,12 @@ static int plugin_load_file(const char *file, _Bool global) {
     char errbuf[1024] = "";
 
     snprintf(errbuf, sizeof(errbuf),
-              "dlopen (\"%s\") failed: %s. "
-              "The most common cause for this problem is "
-              "missing dependencies. Use ldd(1) to check "
-              "the dependencies of the plugin "
-              "/ shared object.",
-              file, dlerror());
+             "dlopen (\"%s\") failed: %s. "
+             "The most common cause for this problem is "
+             "missing dependencies. Use ldd(1) to check "
+             "the dependencies of the plugin "
+             "/ shared object.",
+             file, dlerror());
 
     ERROR("%s", errbuf);
     /* Make sure this is printed to STDERR in any case, but also
index dd17fac4576e3863d9431d4a1d19f4547244c78c..a577aefc766e4ad9326a0ee2cc2b1c844ebe7511 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
@@ -110,7 +110,7 @@ static const char *cdbi_strerror(dbi_conn conn, /* {{{ */
     snprintf(buffer, buffer_size, "%s (status %i)", msg, status);
   else
     snprintf(buffer, buffer_size, "dbi_conn_error failed with status %i",
-              status);
+             status);
 
   return buffer;
 } /* }}} const char *cdbi_conn_error */
index fbea0645ea02384afe57fcda97cb8fcb68f2cdd1..51a50fd1e7c782d6d00ab12be68fbcc42bbfbe85 100644 (file)
@@ -405,8 +405,8 @@ static int disk_read(void) {
 
   /* Get the list of all disk objects. */
   if (IOServiceGetMatchingServices(
-                                   io_master_port, IOServiceMatching(kIOBlockStorageDriverClass),
-                                   &disk_list) != kIOReturnSuccess) {
+          io_master_port, IOServiceMatching(kIOBlockStorageDriverClass),
+          &disk_list) != kIOReturnSuccess) {
     ERROR("disk plugin: IOServiceGetMatchingServices failed.");
     return -1;
   }
@@ -490,8 +490,7 @@ static int disk_read(void) {
         sstrncpy(disk_name, props_disk_name_bsd, sizeof(disk_name));
       else {
         ERROR("disk plugin: can't find bsd disk name.");
-        snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major,
-                  disk_minor);
+        snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
       }
     } else
       snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
index 3941f1b693df704eae899600dd867e01728b351b..381ddc00bf8407069e38fdb3c57a7b95dd3b09bf 100644 (file)
@@ -232,7 +232,7 @@ static int dpdk_events_link_status_config(dpdk_events_ctx_t *ec,
       while (!(ec->config.link_status.enabled_port_mask & (1 << port_num)))
         port_num++;
       snprintf(ec->config.link_status.port_name[port_num], DATA_MAX_NAME_LEN,
-                "%s", child->values[0].value.string);
+               "%s", child->values[0].value.string);
       DEBUG(DPDK_EVENTS_PLUGIN ": LinkStatus:Port %d Name: %s", port_num,
             ec->config.link_status.port_name[port_num]);
       port_num++;
@@ -257,7 +257,7 @@ static int dpdk_events_keep_alive_config(dpdk_events_ctx_t *ec,
     } else if (strcasecmp("LCoreMask", child->key) == 0) {
       char lcore_mask[DATA_MAX_NAME_LEN];
       snprintf(lcore_mask, sizeof(lcore_mask), "%s",
-                child->values[0].value.string);
+               child->values[0].value.string);
       ec->config.keep_alive.lcore_mask =
           str_to_uint128(lcore_mask, strlen(lcore_mask));
       DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:LCoreMask 0x%" PRIX64 "%" PRIX64 "",
@@ -265,8 +265,8 @@ static int dpdk_events_keep_alive_config(dpdk_events_ctx_t *ec,
             ec->config.keep_alive.lcore_mask.low);
     } else if (strcasecmp("KeepAliveShmName", child->key) == 0) {
       snprintf(ec->config.keep_alive.shm_name,
-                sizeof(ec->config.keep_alive.shm_name), "%s",
-                child->values[0].value.string);
+               sizeof(ec->config.keep_alive.shm_name), "%s",
+               child->values[0].value.string);
       DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:KeepAliveShmName %s",
             ec->config.keep_alive.shm_name);
     } else if (strcasecmp("SendNotification", child->key) == 0) {
@@ -406,7 +406,7 @@ static int dpdk_events_link_status_dispatch(dpdk_helper_ctx_t *phc) {
         char dev_name[DATA_MAX_NAME_LEN];
         if (ec->config.link_status.port_name[i][0] != 0) {
           snprintf(dev_name, sizeof(dev_name), "%s",
-                    ec->config.link_status.port_name[i]);
+                   ec->config.link_status.port_name[i]);
         } else {
           snprintf(dev_name, sizeof(dev_name), "port.%d", i);
         }
@@ -415,7 +415,7 @@ static int dpdk_events_link_status_dispatch(dpdk_helper_ctx_t *phc) {
           int sev = ec->link_info[i].link_status ? NOTIF_OKAY : NOTIF_WARNING;
           char msg[DATA_MAX_NAME_LEN];
           snprintf(msg, sizeof(msg), "Link Status: %s",
-                    ec->link_info[i].link_status ? "UP" : "DOWN");
+                   ec->link_info[i].link_status ? "UP" : "DOWN");
           dpdk_events_notification_dispatch(sev, dev_name,
                                             ec->link_info[i].read_time, msg);
         } else {
index 87e36e65f4444871c6ec8e8218d65796294f1f1c..22da3160be6c6bb7054c80f9533e8089d421910f 100644 (file)
@@ -187,8 +187,7 @@ static int exec_config_exec(oconfig_item_t *ci) /* {{{ */
       pl->argv[i] = strdup(ci->values[i + 1].value.string);
     } else {
       if (ci->values[i + 1].type == OCONFIG_TYPE_NUMBER) {
-        snprintf(buffer, sizeof(buffer), "%lf",
-                  ci->values[i + 1].value.number);
+        snprintf(buffer, sizeof(buffer), "%lf", ci->values[i + 1].value.number);
       } else {
         if (ci->values[i + 1].value.boolean)
           sstrncpy(buffer, "true", sizeof(buffer));
@@ -247,14 +246,14 @@ static void set_environment(void) /* {{{ */
 
 #ifdef HAVE_SETENV
   snprintf(buffer, sizeof(buffer), "%.3f",
-            CDTIME_T_TO_DOUBLE(plugin_get_interval()));
+           CDTIME_T_TO_DOUBLE(plugin_get_interval()));
   setenv("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
 
   sstrncpy(buffer, hostname_g, sizeof(buffer));
   setenv("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
 #else
   snprintf(buffer, sizeof(buffer), "COLLECTD_INTERVAL=%.3f",
-            CDTIME_T_TO_DOUBLE(plugin_get_interval()));
+           CDTIME_T_TO_DOUBLE(plugin_get_interval()));
   putenv(buffer);
 
   snprintf(buffer, sizeof(buffer), "COLLECTD_HOSTNAME=%s", hostname_g);
index 75643c44e6f9abceb137ced0305aa8a0ae7ce69e..50bd8323b24f47522ef08ed711040ef73aa55494 100644 (file)
@@ -418,7 +418,7 @@ static staging_entry_t *staging_entry_get(const char *host, /* {{{ */
     return NULL;
 
   snprintf(key, sizeof(key), "%s/%s/%s", host, type,
-            (type_instance != NULL) ? type_instance : "");
+           (type_instance != NULL) ? type_instance : "");
 
   se = NULL;
   status = c_avl_get(staging_tree, key, (void *)&se);
index 8af7f50ede5f5d2964413509837a902f548089a9..c5b0ecb996328032fe1384469238412240a28bb5 100644 (file)
@@ -88,10 +88,10 @@ static void submit_hp(const struct entry_info *info) {
   sstrncpy(vl.plugin, g_plugin_name, sizeof(vl.plugin));
   if (info->node) {
     snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%zuKb",
-              info->node, info->page_size_kb);
+             info->node, info->page_size_kb);
   } else {
     snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%zuKb",
-              info->page_size_kb);
+             info->page_size_kb);
   }
 
   /* ensure all metrics have the same timestamp */
index 2ff7db2a1690dd3ffa1da8ac41a99cd474430c8e..deba1860ec1f1dd7312932ff786168995830a992 100644 (file)
@@ -297,7 +297,7 @@ static int interface_read(void) {
 
     if (unique_name)
       snprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module,
-                ksp[i]->ks_instance, ksp[i]->ks_name);
+               ksp[i]->ks_instance, ksp[i]->ks_name);
     else
       sstrncpy(iname, ksp[i]->ks_name, sizeof(iname));
 
index ff79049b0693183484a8e968d6d44bcf4ee9a955..c8c80429d0813aa3ef7b2726a8d6d11373ca0d11 100644 (file)
@@ -124,7 +124,7 @@ static void sensor_read_handler(ipmi_sensor_t *sensor, int err,
                    sizeof(n.type_instance));
           sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
           snprintf(n.message, sizeof(n.message), "sensor %s not present",
-                    list_item->sensor_name);
+                   list_item->sensor_name);
 
           plugin_dispatch_notification(&n);
         }
@@ -173,7 +173,7 @@ static void sensor_read_handler(ipmi_sensor_t *sensor, int err,
                sizeof(n.type_instance));
       sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
       snprintf(n.message, sizeof(n.message), "sensor %s present",
-                list_item->sensor_name);
+               list_item->sensor_name);
 
       plugin_dispatch_notification(&n);
     }
@@ -224,7 +224,7 @@ static int sensor_list_add(ipmi_sensor_t *sensor) {
     sstrncpy(sensor_name, buffer, sizeof(sensor_name));
   else
     snprintf(sensor_name, sizeof(sensor_name), "%s %s", buffer,
-              entity_id_string);
+             entity_id_string);
 
   sstrncpy(buffer, sensor_name, sizeof(buffer));
   sensor_name_ptr = strstr(buffer, ").");
@@ -245,7 +245,7 @@ static int sensor_list_add(ipmi_sensor_t *sensor) {
     if (sensor_id_ptr != NULL) {
       /* `sensor_id_ptr' now points to "(123)". */
       snprintf(sensor_name, sizeof(sensor_name), "%s %s", sensor_name_ptr,
-                sensor_id_ptr);
+               sensor_id_ptr);
     }
     /* else: don't touch sensor_name. */
   }
@@ -328,7 +328,7 @@ static int sensor_list_add(ipmi_sensor_t *sensor) {
     sstrncpy(n.type_instance, list_item->sensor_name, sizeof(n.type_instance));
     sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
     snprintf(n.message, sizeof(n.message), "sensor %s added",
-              list_item->sensor_name);
+             list_item->sensor_name);
 
     plugin_dispatch_notification(&n);
   }
@@ -376,7 +376,7 @@ static int sensor_list_remove(ipmi_sensor_t *sensor) {
     sstrncpy(n.type_instance, list_item->sensor_name, sizeof(n.type_instance));
     sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
     snprintf(n.message, sizeof(n.message), "sensor %s removed",
-              list_item->sensor_name);
+             list_item->sensor_name);
 
     plugin_dispatch_notification(&n);
   }
index 8969cf74a60d88ed09774f2e9e6057586c39b02b..286c6e9b6ca4318fa6a1b059e3f1337643434e19 100644 (file)
@@ -101,7 +101,7 @@ static int iptables_config(const char *key, const char *value) {
     return 1;
 
   ip_chain_t temp = {0};
-  ip_chain_t * final, **list;
+  ip_chain_t *final, **list;
   char *table;
   int table_len;
   char *chain;
@@ -189,7 +189,7 @@ static int iptables_config(const char *key, const char *value) {
   }
 
   chain_list = list;
-  final = malloc(sizeof(* final));
+  final = malloc(sizeof(*final));
   if (final == NULL) {
     char errbuf[1024];
     ERROR("malloc failed: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
@@ -227,7 +227,7 @@ static int submit6_match(const struct ip6t_entry_match *match,
   sstrncpy(vl.plugin, "ip6tables", sizeof(vl.plugin));
 
   status = snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
-                     chain->table, chain->chain);
+                    chain->table, chain->chain);
   if ((status < 1) || ((unsigned int)status >= sizeof(vl.plugin_instance)))
     return 0;
 
@@ -236,7 +236,7 @@ static int submit6_match(const struct ip6t_entry_match *match,
   } else {
     if (chain->rule_type == RTYPE_NUM)
       snprintf(vl.type_instance, sizeof(vl.type_instance), "%i",
-                chain->rule.num);
+               chain->rule.num);
     else
       sstrncpy(vl.type_instance, (char *)match->data, sizeof(vl.type_instance));
   }
@@ -275,7 +275,7 @@ static int submit_match(const struct ipt_entry_match *match,
   sstrncpy(vl.plugin, "iptables", sizeof(vl.plugin));
 
   status = snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
-                     chain->table, chain->chain);
+                    chain->table, chain->chain);
   if ((status < 1) || ((unsigned int)status >= sizeof(vl.plugin_instance)))
     return 0;
 
@@ -284,7 +284,7 @@ static int submit_match(const struct ipt_entry_match *match,
   } else {
     if (chain->rule_type == RTYPE_NUM)
       snprintf(vl.type_instance, sizeof(vl.type_instance), "%i",
-                chain->rule.num);
+               chain->rule.num);
     else
       sstrncpy(vl.type_instance, (char *)match->data, sizeof(vl.type_instance));
   }
index f747cb0765a398117494de26886e54b8fb64f6d7..3d399bd522ea86b26bee6ec22f3040608b7a79ae 100644 (file)
@@ -173,7 +173,7 @@ static int get_pi(struct ip_vs_service_entry *se, char *pi, size_t size) {
 
   int len =
       snprintf(pi, size, "%s_%s%u", inet_ntoa(addr),
-                (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", ntohs(se->port));
+               (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", ntohs(se->port));
 
   if ((len < 0) || (size <= ((size_t)len))) {
     log_err("plugin instance truncated: %s", pi);
index e3d3442a5961e29dcad82075d74fae043b1b6edf..c7b0be3dcba40d3e742282035577483e4f584c04 100644 (file)
@@ -1213,9 +1213,9 @@ static int jtoc_notification(JNIEnv *jvm_env, notification_t *n, /* {{{ */
 
   return 0;
 } /* }}} int jtoc_notification */
-  /*
  * Functions accessible from Java
  */
+/*
+ * Functions accessible from Java
+ */
 static jint JNICALL cjni_api_dispatch_values(JNIEnv *jvm_env, /* {{{ */
                                              jobject this, jobject java_vl) {
   value_list_t vl = VALUE_LIST_INIT;
index d7d011c1f5cfde4ed94db5a3780815255b79692f..de9b1f75b19512632ef7a9649470fca5ac637620 100644 (file)
@@ -177,7 +177,7 @@ static int logfile_notification(const notification_t *n,
 
 #define APPEND(bufptr, buflen, key, value)                                     \
   if ((buflen > 0) && (strlen(value) > 0)) {                                   \
-    status = snprintf(bufptr, buflen, ", %s = %s", key, value);               \
+    status = snprintf(bufptr, buflen, ", %s = %s", key, value);                \
     if (status > 0) {                                                          \
       bufptr += status;                                                        \
       buflen -= status;                                                        \
index ffed47031af681fcc4b023b495bdd95d7040c62d..8cfb70459991317048e6cdeb0b6be27146c95cdf 100644 (file)
--- a/src/lua.c
+++ b/src/lua.c
@@ -306,9 +306,10 @@ static int lua_cb_register_read(lua_State *L) /* {{{ */
   int status = plugin_register_complex_read(/* group = */ "lua",
                                             /* name      = */ function_name,
                                             /* callback  = */ clua_read,
-                                            /* interval  = */ 0, &(user_data_t){
-                                                                     .data = cb,
-                                                                 });
+                                            /* interval  = */ 0,
+                                            &(user_data_t){
+                                                .data = cb,
+                                            });
 
   if (status != 0)
     return luaL_error(L, "%s", "plugin_register_complex_read failed");
@@ -346,11 +347,11 @@ static int lua_cb_register_write(lua_State *L) /* {{{ */
   cb->lua_function_name = strdup(function_name);
   pthread_mutex_init(&cb->lock, NULL);
 
-  int status =
-      plugin_register_write(/* name = */ function_name,
-                            /* callback  = */ clua_write, &(user_data_t){
-                                                              .data = cb,
-                                                          });
+  int status = plugin_register_write(/* name = */ function_name,
+                                     /* callback  = */ clua_write,
+                                     &(user_data_t){
+                                         .data = cb,
+                                     });
 
   if (status != 0)
     return luaL_error(L, "%s", "plugin_register_write failed");
index 11232651eff4b33976b7a18ead8dc0dbfa8fd65b..63107279be19da94f6754caf7423f2140da29114 100644 (file)
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -77,8 +77,7 @@ static void report_lv_utilization(lv_t lv, char const *vg_name,
     return;
   used_bytes = lv_size * (used_percent_unscaled * PERCENT_SCALE_FACTOR);
 
-  snprintf(plugin_instance, sizeof(plugin_instance), "%s-%s", vg_name,
-            lv_name);
+  snprintf(plugin_instance, sizeof(plugin_instance), "%s-%s", vg_name, lv_name);
   lvm_submit(plugin_instance, "used", used_bytes);
   lvm_submit(plugin_instance, "free", lv_size - used_bytes);
 }
index aa1f0955da9df08231abd6141c75e60500468011..1a387b7884c657340107e1a3b7f57555eff18951 100644 (file)
@@ -561,7 +561,7 @@ static void submit_antx(const char *dev, const char *name, u_int32_t *vals,
 static inline void macaddr_to_str(char *buf, size_t bufsize,
                                   const uint8_t mac[IEEE80211_ADDR_LEN]) {
   snprintf(buf, bufsize, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1],
-            mac[2], mac[3], mac[4], mac[5]);
+           mac[2], mac[3], mac[4], mac[5]);
 }
 
 static void process_stat_struct(int which, const void *ptr, const char *dev,
index 14054bdf14a40e0293168996cc3593f6198b451b..b8731c73391ca6796080823cebee64951e984ff1 100644 (file)
@@ -292,14 +292,14 @@ static int mcelog_submit(const mcelog_memory_rec_t *mr) {
 
   if (mr->dimm_name[0] != '\0')
     snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s_%s",
-              mr->location, mr->dimm_name);
+             mr->location, mr->dimm_name);
   else
     sstrncpy(vl.plugin_instance, mr->location, sizeof(vl.plugin_instance));
 
   plugin_dispatch_values(&vl);
 
   snprintf(vl.type_instance, sizeof(vl.type_instance),
-            "corrected_memory_errors_in_%s", mr->corrected_err_timed_period);
+           "corrected_memory_errors_in_%s", mr->corrected_err_timed_period);
   vl.values = &(value_t){.derive = (derive_t)mr->corrected_err_timed};
   plugin_dispatch_values(&vl);
 
@@ -309,8 +309,7 @@ static int mcelog_submit(const mcelog_memory_rec_t *mr) {
   plugin_dispatch_values(&vl);
 
   snprintf(vl.type_instance, sizeof(vl.type_instance),
-            "uncorrected_memory_errors_in_%s",
-            mr->uncorrected_err_timed_period);
+           "uncorrected_memory_errors_in_%s", mr->uncorrected_err_timed_period);
   vl.values = &(value_t){.derive = (derive_t)mr->uncorrected_err_timed};
   plugin_dispatch_values(&vl);
 
index eef453e1b90189e7c3a08ef78c7db4e7d31d2dcc..e4ccbce60f4aaddc19fe5c7e3d8c2e379f97a0cd 100644 (file)
@@ -478,7 +478,7 @@ static int memcached_add_read_callback(memcached_t *st) {
   int status;
 
   snprintf(callback_name, sizeof(callback_name), "memcached/%s",
-            (st->name != NULL) ? st->name : "__legacy__");
+           (st->name != NULL) ? st->name : "__legacy__");
 
   /* If no <Address> used then:
    * - Connect to the destination specified by <Host>, if present.
@@ -520,9 +520,10 @@ static int memcached_add_read_callback(memcached_t *st) {
       /* group = */ "memcached",
       /* name      = */ callback_name,
       /* callback  = */ memcached_read,
-      /* interval  = */ 0, &(user_data_t){
-                               .data = st, .free_func = memcached_free,
-                           });
+      /* interval  = */ 0,
+      &(user_data_t){
+          .data = st, .free_func = memcached_free,
+      });
 
   return status;
 } /* int memcached_add_read_callback */
index 166e598b650050f1579f55bc6361974cf821688e..a7ee433c2279f7e0e4f143bf66287b14f5bafe8f 100644 (file)
--- a/src/mic.c
+++ b/src/mic.c
@@ -211,7 +211,7 @@ static void mic_submit_cpu(int micnumber, const char *type_instance, int core,
     snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
   else /* per-core statistics */
     snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i-cpu-%i",
-              micnumber, core);
+             micnumber, core);
   strncpy(vl.type, "cpu", sizeof(vl.type));
   strncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
 
index 94686b032d511f3729eb940fcd932b5d65e22a7f..851866b082051d38b9f292de35eae691ed6d7a75 100644 (file)
@@ -475,8 +475,8 @@ static int format_topic(char *buf, size_t buf_len, data_set_t const *ds,
   if ((status < 0) || (((size_t)status) >= buf_len))
     return ENOMEM;
 
-  while((c = strchr(buf, '#')) || (c = strchr(buf, '+'))) {
-       *c = '_';
+  while ((c = strchr(buf, '#')) || (c = strchr(buf, '+'))) {
+    *c = '_';
   }
 
   return 0;
@@ -609,9 +609,10 @@ static int mqtt_config_publisher(oconfig_item_t *ci) {
   }
 
   snprintf(cb_name, sizeof(cb_name), "mqtt/%s", conf->name);
-  plugin_register_write(cb_name, mqtt_write, &(user_data_t){
-                                                 .data = conf,
-                                             });
+  plugin_register_write(cb_name, mqtt_write,
+                        &(user_data_t){
+                            .data = conf,
+                        });
   return 0;
 } /* mqtt_config_publisher */
 
index cfc9b59f7a7f53825a883abac0ab5e5be8cd6927..7fe6d76470724861304a0a601d24c1993d19da2b 100644 (file)
@@ -497,14 +497,14 @@ static int mysql_read_slave_stats(mysql_database_t *db, MYSQL *con) {
         (db->slave_io_running)) {
       n.severity = NOTIF_WARNING;
       snprintf(n.message, sizeof(n.message),
-                "slave I/O thread not started or not connected to master");
+               "slave I/O thread not started or not connected to master");
       plugin_dispatch_notification(&n);
       db->slave_io_running = 0;
     } else if (((io != NULL) && (strcasecmp(io, "yes") == 0)) &&
                (!db->slave_io_running)) {
       n.severity = NOTIF_OKAY;
       snprintf(n.message, sizeof(n.message),
-                "slave I/O thread started and connected to master");
+               "slave I/O thread started and connected to master");
       plugin_dispatch_notification(&n);
       db->slave_io_running = 1;
     }
index 0b80f76de6da377e08f91194ea4429414c92cb3b..44fb976841c3c96d383729f87ce8c0941aec53b7 100644 (file)
@@ -654,9 +654,11 @@ static int submit_derive(const char *host, const char *plugin_inst, /* {{{ */
                          const char *type, const char *type_inst,
                          derive_t counter, cdtime_t timestamp,
                          cdtime_t interval) {
-  return submit_values(host, plugin_inst, type, type_inst, &(value_t){
-      .derive=counter,
-    }, 1, timestamp, interval);
+  return submit_values(host, plugin_inst, type, type_inst,
+                       &(value_t){
+                           .derive = counter,
+                       },
+                       1, timestamp, interval);
 } /* }}} int submit_derive */
 
 static int submit_two_gauge(const char *host, const char *plugin_inst, /* {{{ */
@@ -674,9 +676,11 @@ static int submit_two_gauge(const char *host, const char *plugin_inst, /* {{{ */
 static int submit_double(const char *host, const char *plugin_inst, /* {{{ */
                          const char *type, const char *type_inst, double d,
                          cdtime_t timestamp, cdtime_t interval) {
-  return submit_values(host, plugin_inst, type, type_inst, &(value_t){
-      .gauge=d,
-    }, 1, timestamp, interval);
+  return submit_values(host, plugin_inst, type, type_inst,
+                       &(value_t){
+                           .gauge = d,
+                       },
+                       1, timestamp, interval);
 } /* }}} int submit_uint64 */
 
 /* Calculate hit ratio from old and new counters and submit the resulting
@@ -770,12 +774,13 @@ static int submit_volume_perf_data(const char *hostname, /* {{{ */
     return -1;
 
   snprintf(plugin_instance, sizeof(plugin_instance), "volume-%s",
-            old_data->name);
+           old_data->name);
 
   /* Check for and submit disk-octet values */
   if (HAS_ALL_FLAGS(old_data->flags, CFG_VOLUME_PERF_IO) &&
-      HAS_ALL_FLAGS(new_data->flags, HAVE_VOLUME_PERF_BYTES_READ |
-                                         HAVE_VOLUME_PERF_BYTES_WRITE)) {
+      HAS_ALL_FLAGS(new_data->flags,
+                    HAVE_VOLUME_PERF_BYTES_READ |
+                        HAVE_VOLUME_PERF_BYTES_WRITE)) {
     submit_two_derive(
         hostname, plugin_instance, "disk_octets", /* type instance = */ NULL,
         (derive_t)new_data->read_bytes, (derive_t)new_data->write_bytes,
@@ -793,15 +798,15 @@ static int submit_volume_perf_data(const char *hostname, /* {{{ */
   }
 
   /* Check for, calculate and submit disk-latency values */
-  if (HAS_ALL_FLAGS(old_data->flags, CFG_VOLUME_PERF_LATENCY |
-                                         HAVE_VOLUME_PERF_OPS_READ |
-                                         HAVE_VOLUME_PERF_OPS_WRITE |
-                                         HAVE_VOLUME_PERF_LATENCY_READ |
-                                         HAVE_VOLUME_PERF_LATENCY_WRITE) &&
-      HAS_ALL_FLAGS(new_data->flags, HAVE_VOLUME_PERF_OPS_READ |
-                                         HAVE_VOLUME_PERF_OPS_WRITE |
-                                         HAVE_VOLUME_PERF_LATENCY_READ |
-                                         HAVE_VOLUME_PERF_LATENCY_WRITE)) {
+  if (HAS_ALL_FLAGS(old_data->flags,
+                    CFG_VOLUME_PERF_LATENCY | HAVE_VOLUME_PERF_OPS_READ |
+                        HAVE_VOLUME_PERF_OPS_WRITE |
+                        HAVE_VOLUME_PERF_LATENCY_READ |
+                        HAVE_VOLUME_PERF_LATENCY_WRITE) &&
+      HAS_ALL_FLAGS(new_data->flags,
+                    HAVE_VOLUME_PERF_OPS_READ | HAVE_VOLUME_PERF_OPS_WRITE |
+                        HAVE_VOLUME_PERF_LATENCY_READ |
+                        HAVE_VOLUME_PERF_LATENCY_WRITE)) {
     gauge_t latency_per_op_read;
     gauge_t latency_per_op_write;
 
@@ -1401,8 +1406,9 @@ static int cna_submit_volume_usage_data(const char *hostname, /* {{{ */
 
     snprintf(plugin_instance, sizeof(plugin_instance), "volume-%s", v->name);
 
-    if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_SNAP_USED |
-                                    HAVE_VOLUME_USAGE_SNAP_RSVD)) {
+    if (HAS_ALL_FLAGS(v->flags,
+                      HAVE_VOLUME_USAGE_SNAP_USED |
+                          HAVE_VOLUME_USAGE_SNAP_RSVD)) {
       if (v->snap_reserved > v->snap_used) {
         snap_reserve_free = v->snap_reserved - v->snap_used;
         snap_reserve_used = v->snap_used;
@@ -1416,8 +1422,9 @@ static int cna_submit_volume_usage_data(const char *hostname, /* {{{ */
 
     /* The space used by snapshots but not reserved for them is included in
      * both, norm_used and snap_norm_used. If possible, subtract this here. */
-    if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_NORM_USED |
-                                    HAVE_VOLUME_USAGE_SNAP_USED)) {
+    if (HAS_ALL_FLAGS(v->flags,
+                      HAVE_VOLUME_USAGE_NORM_USED |
+                          HAVE_VOLUME_USAGE_SNAP_USED)) {
       if (norm_used >= snap_norm_used)
         norm_used -= snap_norm_used;
       else {
@@ -1459,8 +1466,9 @@ static int cna_submit_volume_usage_data(const char *hostname, /* {{{ */
                     "df_complex", "snap_reserved", (double)snap_reserve_free,
                     /* timestamp = */ 0, interval);
 
-    if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_SNAP_USED |
-                                    HAVE_VOLUME_USAGE_SNAP_RSVD))
+    if (HAS_ALL_FLAGS(v->flags,
+                      HAVE_VOLUME_USAGE_SNAP_USED |
+                          HAVE_VOLUME_USAGE_SNAP_RSVD))
       submit_double(hostname, /* plugin instance = */ plugin_instance,
                     "df_complex", "snap_reserve_used",
                     (double)snap_reserve_used, /* timestamp = */ 0, interval);
@@ -1490,13 +1498,12 @@ static int cna_change_volume_status(const char *hostname, /* {{{ */
 
   if ((v->flags & IS_VOLUME_USAGE_OFFLINE) != 0) {
     n.severity = NOTIF_OKAY;
-    snprintf(n.message, sizeof(n.message), "Volume %s is now online.",
-              v->name);
+    snprintf(n.message, sizeof(n.message), "Volume %s is now online.", v->name);
     v->flags &= ~IS_VOLUME_USAGE_OFFLINE;
   } else {
     n.severity = NOTIF_WARNING;
     snprintf(n.message, sizeof(n.message), "Volume %s is now offline.",
-              v->name);
+             v->name);
     v->flags |= IS_VOLUME_USAGE_OFFLINE;
   }
 
@@ -1723,8 +1730,8 @@ static int cna_handle_volume_usage_data(const host_config_t *host, /* {{{ */
     }
   } /* for (elem_volume) */
 
-  return cna_submit_volume_usage_data(host->name, cfg_volume,
-                                      host->cfg_volume_usage->interval.interval);
+  return cna_submit_volume_usage_data(
+      host->name, cfg_volume, host->cfg_volume_usage->interval.interval);
 } /* }}} int cna_handle_volume_usage_data */
 
 static int cna_setup_volume_usage(cfg_volume_usage_t *cvu) /* {{{ */
@@ -1826,7 +1833,7 @@ static int cna_handle_quota_data(const host_config_t *host, /* {{{ */
       continue;
 
     snprintf(plugin_instance, sizeof(plugin_instance), "quota-%s-%s",
-              volume_name, tree_name);
+             volume_name, tree_name);
 
     value = na_child_get_uint64(elem_quota, "disk-used", UINT64_MAX);
     if (value != UINT64_MAX) {
@@ -1939,7 +1946,7 @@ static int cna_handle_snapvault_data(const char *hostname, /* {{{ */
 
     /* possible TODO: make plugin instance configurable */
     snprintf(plugin_instance, sizeof(plugin_instance), "snapvault-%s",
-              dest_path);
+             dest_path);
     submit_double(hostname, plugin_instance, /* type = */ "delay", NULL,
                   (double)value, /* timestamp = */ 0, interval);
 
@@ -2817,7 +2824,7 @@ static int cna_register_host(host_config_t *host) /* {{{ */
 
   if (host->vfiler)
     snprintf(cb_name, sizeof(cb_name), "netapp-%s-%s", host->name,
-              host->vfiler);
+             host->vfiler);
   else
     snprintf(cb_name, sizeof(cb_name), "netapp-%s", host->name);
 
index 9d84956d66f8274cb82e656216cb6fc23155056d..0bac3e7582dddb8b1a084e8a42fb1aa073454225 100644 (file)
@@ -496,7 +496,7 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) {
       numberic_id = tm->tcm_parent;
 
     snprintf(tc_inst, sizeof(tc_inst), "%s-%x:%x", kind, numberic_id >> 16,
-              numberic_id & 0x0000FFFF);
+             numberic_id & 0x0000FFFF);
   }
 
   DEBUG("netlink plugin: qos_filter_cb: got %s for %s (%i).", tc_type, dev,
@@ -527,8 +527,7 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) {
 
       stats_submitted = 1;
 
-      snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
-                tc_inst);
+      snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
 
       if (q_stats.bs != NULL) {
         submit_one(dev, "ipt_bytes", type_instance, q_stats.bs->bytes);
@@ -560,8 +559,7 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) {
     if (!stats_submitted && ts != NULL) {
       char type_instance[DATA_MAX_NAME_LEN];
 
-      snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
-                tc_inst);
+      snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
 
       submit_one(dev, "ipt_bytes", type_instance, ts->bytes);
       submit_one(dev, "ipt_packets", type_instance, ts->packets);
index 00c6c756623332e761ac53a4cbcf6e502d072fbf..375da84738dbbdec8d39fe177212e3086d4aeada 100644 (file)
@@ -2652,10 +2652,10 @@ static int network_write(const data_set_t *ds, const value_list_t *vl,
 
   pthread_mutex_lock(&send_buffer_lock);
 
-  status =
-      add_to_buffer(send_buffer_ptr, network_config_packet_size -
-                                         (send_buffer_fill + BUFF_SIG_SIZE),
-                    &send_buffer_vl, ds, vl);
+  status = add_to_buffer(send_buffer_ptr,
+                         network_config_packet_size -
+                             (send_buffer_fill + BUFF_SIG_SIZE),
+                         &send_buffer_vl, ds, vl);
   if (status >= 0) {
     /* status == bytes added to the buffer */
     send_buffer_fill += status;
@@ -2666,10 +2666,10 @@ static int network_write(const data_set_t *ds, const value_list_t *vl,
   } else {
     flush_buffer();
 
-    status =
-        add_to_buffer(send_buffer_ptr, network_config_packet_size -
-                                           (send_buffer_fill + BUFF_SIG_SIZE),
-                      &send_buffer_vl, ds, vl);
+    status = add_to_buffer(send_buffer_ptr,
+                           network_config_packet_size -
+                               (send_buffer_fill + BUFF_SIG_SIZE),
+                           &send_buffer_vl, ds, vl);
 
     if (status >= 0) {
       send_buffer_fill += status;
index 6537fd14e44c9565510985626479d87b200999b2..bbe843845ace33b4fd546407eed64306dcf974bd 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
@@ -358,7 +358,7 @@ static void nfs_submit_fields(int nfs_version, const char *instance,
   value_t values[fields_num];
 
   snprintf(plugin_instance, sizeof(plugin_instance), "v%i%s", nfs_version,
-            instance);
+           instance);
 
   for (size_t i = 0; i < fields_num; i++)
     (void)parse_value(fields[i], &values[i], DS_TYPE_DERIVE);
@@ -524,7 +524,7 @@ static int nfs_read_kstat(kstat_t *ksp, int nfs_version, const char *inst,
     return EINVAL;
 
   snprintf(plugin_instance, sizeof(plugin_instance), "v%i%s", nfs_version,
-            inst);
+           inst);
 
   kstat_read(kc, ksp, NULL);
   for (size_t i = 0; i < proc_names_num; i++) {
index f212461be94799b48c20f9014ba960215d1e6953..32e250a9bbfcbe69f9537a8d3224e7b9bff9d86f 100644 (file)
@@ -123,7 +123,7 @@ static int init(void) {
 #else
     static char credentials[1024];
     int status = snprintf(credentials, sizeof(credentials), "%s:%s", user,
-                           pass == NULL ? "" : pass);
+                          pass == NULL ? "" : pass);
     if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
       ERROR("nginx plugin: Credentials would have been truncated.");
       return -1;
index 255230b13ec355f23b9f04da504cb1a1fc46ff12..e391cf275c04410ac76b67bbf6c896977f0fc74f 100644 (file)
@@ -94,11 +94,11 @@ static int c_notify(const notification_t *n,
   }
 
   snprintf(summary, sizeof(summary), "collectd %s notification",
-            (NOTIF_FAILURE == n->severity)
-                ? "FAILURE"
-                : (NOTIF_WARNING == n->severity)
-                      ? "WARNING"
-                      : (NOTIF_OKAY == n->severity) ? "OKAY" : "UNKNOWN");
+           (NOTIF_FAILURE == n->severity)
+               ? "FAILURE"
+               : (NOTIF_WARNING == n->severity)
+                     ? "WARNING"
+                     : (NOTIF_OKAY == n->severity) ? "OKAY" : "UNKNOWN");
 
   notification = notify_notification_new(summary, n->message, NULL
 #if NOTIFY_CHECK_VERSION(0, 7, 0)
index 70408f6580f79b669a2e4439196388b7effe8b30..52cc83843f8f7ec163badaf08925a7d46ed55414 100644 (file)
@@ -105,7 +105,7 @@ static int notify_email_init(void) {
   char server[MAXSTRING];
 
   snprintf(server, sizeof(server), "%s:%i",
-            (smtp_host == NULL) ? DEFAULT_SMTP_HOST : smtp_host, smtp_port);
+           (smtp_host == NULL) ? DEFAULT_SMTP_HOST : smtp_host, smtp_port);
 
   pthread_mutex_lock(&session_lock);
 
@@ -215,15 +215,15 @@ static int notify_email_notification(const notification_t *n,
   int i;
 
   snprintf(severity, sizeof(severity), "%s",
-            (n->severity == NOTIF_FAILURE)
-                ? "FAILURE"
-                : ((n->severity == NOTIF_WARNING)
-                       ? "WARNING"
-                       : ((n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN")));
+           (n->severity == NOTIF_FAILURE)
+               ? "FAILURE"
+               : ((n->severity == NOTIF_WARNING)
+                      ? "WARNING"
+                      : ((n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN")));
 
   snprintf(subject, sizeof(subject),
-            (email_subject == NULL) ? DEFAULT_SMTP_SUBJECT : email_subject,
-            severity, n->host);
+           (email_subject == NULL) ? DEFAULT_SMTP_SUBJECT : email_subject,
+           severity, n->host);
 
   localtime_r(&CDTIME_T_TO_TIME_T(n->time), &timestamp_tm);
   strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S",
@@ -232,14 +232,14 @@ static int notify_email_notification(const notification_t *n,
 
   /* Let's make RFC822 message text with \r\n EOLs */
   snprintf(buf, buf_len, "MIME-Version: 1.0\r\n"
-                          "Content-Type: text/plain; charset=\"US-ASCII\"\r\n"
-                          "Content-Transfer-Encoding: 8bit\r\n"
-                          "Subject: %s\r\n"
-                          "\r\n"
-                          "%s - %s@%s\r\n"
-                          "\r\n"
-                          "Message: %s",
-            subject, timestamp_str, severity, n->host, n->message);
+                         "Content-Type: text/plain; charset=\"US-ASCII\"\r\n"
+                         "Content-Transfer-Encoding: 8bit\r\n"
+                         "Subject: %s\r\n"
+                         "\r\n"
+                         "%s - %s@%s\r\n"
+                         "\r\n"
+                         "Message: %s",
+           subject, timestamp_str, severity, n->host, n->message);
 
   pthread_mutex_lock(&session_lock);
 
index bea0faad3079093fbef68c77884014b5e6b5b375..f744d486156bfba6255fae5a10ee4d1c89750639 100644 (file)
@@ -142,9 +142,9 @@ static int nagios_notify(const notification_t *n, /* {{{ */
   }
 
   snprintf(buffer, sizeof(buffer),
-            "[%.0f] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
-            CDTIME_T_TO_DOUBLE(n->time), n->host, &svc_description[1], code,
-            n->message);
+           "[%.0f] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
+           CDTIME_T_TO_DOUBLE(n->time), n->host, &svc_description[1], code,
+           n->message);
 
   return nagios_print(buffer);
 } /* }}} int nagios_notify */
index fb41a7d903eee9f147da3e22a4108a21c8700168..a19d05c106a13fc858abf09dc485ed13acd4effa 100644 (file)
@@ -783,7 +783,7 @@ static int ntpd_get_name_refclock(char *buffer, size_t buffer_size,
 
   if (include_unit_id)
     snprintf(buffer, buffer_size, "%s-%" PRIu32, refclock_names[refclock_id],
-              unit_id);
+             unit_id);
   else
     sstrncpy(buffer, refclock_names[refclock_id], buffer_size);
 
index 0e290ad89323a3ef32b6bb1b4485c0db7bae6780..1ac1d42610d92ae3f145d2fca94ce0e0305a6da5 100644 (file)
@@ -295,7 +295,7 @@ static int olsrd_cb_links(int lineno, /* {{{ */
       char type_instance[DATA_MAX_NAME_LEN];
 
       snprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0],
-                fields[1]);
+               fields[1]);
 
       DEBUG("olsrd plugin: links: type_instance = %s;  lq = %g;", type_instance,
             lq);
@@ -319,7 +319,7 @@ static int olsrd_cb_links(int lineno, /* {{{ */
       char type_instance[DATA_MAX_NAME_LEN];
 
       snprintf(type_instance, sizeof(type_instance), "%s-%s-rx", fields[0],
-                fields[1]);
+               fields[1]);
 
       DEBUG("olsrd plugin: links: type_instance = %s; nlq = %g;", type_instance,
             lq);
@@ -497,7 +497,7 @@ static int olsrd_cb_topology(int lineno, /* {{{ */
       char type_instance[DATA_MAX_NAME_LEN] = {0};
 
       snprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0],
-                fields[1]);
+               fields[1]);
       DEBUG("olsrd plugin: type_instance = %s; lq = %g;", type_instance, lq);
       olsrd_submit(/* p.-inst = */ "topology", /* type = */ "signal_quality",
                    type_instance, lq);
@@ -516,7 +516,7 @@ static int olsrd_cb_topology(int lineno, /* {{{ */
       char type_instance[DATA_MAX_NAME_LEN] = {0};
 
       snprintf(type_instance, sizeof(type_instance), "%s-%s-nlq", fields[0],
-                fields[1]);
+               fields[1]);
       DEBUG("olsrd plugin: type_instance = %s; nlq = %g;", type_instance, nlq);
       olsrd_submit(/* p.-inst = */ "topology", /* type = */ "signal_quality",
                    type_instance, nlq);
index 7b9b711c2d80b1d7228aa982f2bf15c25c0c7c08..b3fcb10fcbef13c1512fa83a577d84152ff911a5 100644 (file)
@@ -315,7 +315,7 @@ static int cldap_read_host(user_data_t *ud) /* {{{ */
                  ldap_get_values_len(st->ld, e, "olmBDBEntryCache")) != NULL) {
           olmbdb_data = *olmbdb_list[0];
           snprintf(typeinst, sizeof(typeinst), "bdbentrycache-%s",
-                    nc_data.bv_val);
+                   nc_data.bv_val);
           cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
                              st);
           ldap_value_free_len(olmbdb_list);
@@ -324,8 +324,7 @@ static int cldap_read_host(user_data_t *ud) /* {{{ */
         if ((olmbdb_list = ldap_get_values_len(st->ld, e, "olmBDBDNCache")) !=
             NULL) {
           olmbdb_data = *olmbdb_list[0];
-          snprintf(typeinst, sizeof(typeinst), "bdbdncache-%s",
-                    nc_data.bv_val);
+          snprintf(typeinst, sizeof(typeinst), "bdbdncache-%s", nc_data.bv_val);
           cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
                              st);
           ldap_value_free_len(olmbdb_list);
@@ -335,7 +334,7 @@ static int cldap_read_host(user_data_t *ud) /* {{{ */
             NULL) {
           olmbdb_data = *olmbdb_list[0];
           snprintf(typeinst, sizeof(typeinst), "bdbidlcache-%s",
-                    nc_data.bv_val);
+                   nc_data.bv_val);
           cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
                              st);
           ldap_value_free_len(olmbdb_list);
@@ -481,15 +480,16 @@ static int cldap_config_add(oconfig_item_t *ci) /* {{{ */
       databases_num++;
 
       snprintf(callback_name, sizeof(callback_name), "openldap/%s/%s",
-                (st->host != NULL) ? st->host : hostname_g,
-                (st->name != NULL) ? st->name : "default");
+               (st->host != NULL) ? st->host : hostname_g,
+               (st->name != NULL) ? st->name : "default");
 
       status = plugin_register_complex_read(/* group = */ NULL,
                                             /* name      = */ callback_name,
                                             /* callback  = */ cldap_read_host,
-                                            /* interval  = */ 0, &(user_data_t){
-                                                                     .data = st,
-                                                                 });
+                                            /* interval  = */ 0,
+                                            &(user_data_t){
+                                                .data = st,
+                                            });
     }
   }
 
index 2199df264033e75241842e1396a0002c172b15b0..44bd5648d1c4e54eff7eeb48a2add5d07d706129 100644 (file)
@@ -476,8 +476,7 @@ static int o_read_database_query(o_database_t *db, /* {{{ */
     column_names[i] = column_names[i - 1] + DATA_MAX_NAME_LEN;
 
   ALLOC_OR_FAIL(column_values, column_num * sizeof(char *));
-  ALLOC_OR_FAIL(column_values[0],
-                column_num * DATA_MAX_NAME_LEN);
+  ALLOC_OR_FAIL(column_values[0], column_num * DATA_MAX_NAME_LEN);
   for (size_t i = 1; i < column_num; i++)
     column_values[i] = column_values[i - 1] + DATA_MAX_NAME_LEN;
 
index 2499cb4643affe1428a698113a116f0c1bdfb20a..afa11997cfc3a1ec8fadd50a29db39c1d0ecd7b3 100644 (file)
@@ -3,14 +3,17 @@
  *
  * Copyright(c) 2016 Intel Corporation. All rights reserved.
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ *of
  * this software and associated documentation files (the "Software"), to deal in
  * the Software without restriction, including without limitation the rights to
  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
+ * of the Software, and to permit persons to whom the Software is furnished to
+ *do
  * so, subject to the following conditions:
  *
- * The above copyright notice and this permission notice shall be included in all
+ * The above copyright notice and this permission notice shall be included in
+ *all
  * copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@@ -156,7 +159,7 @@ static char *ovs_events_get_select_params() {
     }
     opt_buff = new_buff;
     int ret = snprintf(opt_buff + buff_off, buff_size - buff_off, option_fmt,
-                        iface->name);
+                       iface->name);
     if (ret < 0) {
       sfree(opt_buff);
       return NULL;
@@ -202,8 +205,8 @@ static int ovs_events_config_get_interfaces(const oconfig_item_t *ci) {
   for (int j = 0; j < ci->values_num; j++) {
     /* check interface name type */
     if (ci->values[j].type != OCONFIG_TYPE_STRING) {
-      ERROR(OVS_EVENTS_PLUGIN
-            ": given interface name is not a string [idx=%d]", j);
+      ERROR(OVS_EVENTS_PLUGIN ": given interface name is not a string [idx=%d]",
+            j);
       return -1;
     }
     /* allocate memory for configured interface */
@@ -278,9 +281,10 @@ static int ovs_events_plugin_config(oconfig_item_t *ci) {
   }
   /* Check and warn about invalid configuration */
   if (!ovs_events_ctx.config.send_notification && !dispatch_values) {
-      WARNING(OVS_EVENTS_PLUGIN ": send notification and dispatch values "
-              "options are disabled. No information will be dispatched by the "
-              "plugin. Please check your configuration");
+    WARNING(OVS_EVENTS_PLUGIN
+            ": send notification and dispatch values "
+            "options are disabled. No information will be dispatched by the "
+            "plugin. Please check your configuration");
   }
   /* Dispatch link status values if configured */
   if (dispatch_values)
@@ -291,7 +295,8 @@ static int ovs_events_plugin_config(oconfig_item_t *ci) {
 }
 
 /* Dispatch OVS interface link status event to collectd */
-static void ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifinfo) {
+static void
+ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifinfo) {
   const char *msg_link_status = NULL;
   notification_t n = {
       NOTIF_FAILURE, cdtime(), "", "", OVS_EVENTS_PLUGIN, "", "", "", NULL};
@@ -335,8 +340,8 @@ static void ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifin
 
   /* fill the notification data */
   snprintf(n.message, sizeof(n.message),
-            "link state of \"%s\" interface has been changed to \"%s\"",
-            ifinfo->name, msg_link_status);
+           "link state of \"%s\" interface has been changed to \"%s\"",
+           ifinfo->name, msg_link_status);
   sstrncpy(n.host, hostname_g, sizeof(n.host));
   sstrncpy(n.plugin_instance, ifinfo->name, sizeof(n.plugin_instance));
   sstrncpy(n.type, "gauge", sizeof(n.type));
@@ -345,7 +350,8 @@ static void ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifin
 }
 
 /* Dispatch OVS interface link status value to collectd */
-static void ovs_events_link_status_submit(const ovs_events_iface_info_t *ifinfo) {
+static void
+ovs_events_link_status_submit(const ovs_events_iface_info_t *ifinfo) {
   value_list_t vl = VALUE_LIST_INIT;
   meta_data_t *meta = NULL;
 
index 31af77c841d9543d8b7f34fa4e86a2baf0f17802..20b0dd1f0174fbd31104f837c82572f339bc4843 100644 (file)
@@ -3,14 +3,17 @@
  *
  * Copyright(c) 2016 Intel Corporation. All rights reserved.
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of
  * this software and associated documentation files (the "Software"), to deal in
  * the Software without restriction, including without limitation the rights to
  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
+ * of the Software, and to permit persons to whom the Software is furnished to
+ * do
  * so, subject to the following conditions:
  *
- * The above copyright notice and this permission notice shall be included in all
+ * The above copyright notice and this permission notice shall be included in
+ * all
  * copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@@ -711,33 +714,30 @@ static void ovs_stats_initialize(ovs_db_t *pdb) {
                                      "external_ids", NULL};
 
   /* subscribe to a tables */
-  ovs_db_table_cb_register(pdb, "Bridge", bridge_columns,
-                           ovs_stats_bridge_table_change_cb,
+  ovs_db_table_cb_register(
+      pdb, "Bridge", bridge_columns, ovs_stats_bridge_table_change_cb,
       ovs_stats_bridge_table_result_cb,
-                           OVS_DB_TABLE_CB_FLAG_INITIAL |
-                           OVS_DB_TABLE_CB_FLAG_INSERT |
+      OVS_DB_TABLE_CB_FLAG_INITIAL | OVS_DB_TABLE_CB_FLAG_INSERT |
           OVS_DB_TABLE_CB_FLAG_MODIFY);
 
   ovs_db_table_cb_register(pdb, "Bridge", bridge_columns,
                            ovs_stats_bridge_table_delete_cb, NULL,
                            OVS_DB_TABLE_CB_FLAG_DELETE);
 
-  ovs_db_table_cb_register(pdb, "Port", port_columns,
-                           ovs_stats_port_table_change_cb,
+  ovs_db_table_cb_register(
+      pdb, "Port", port_columns, ovs_stats_port_table_change_cb,
       ovs_stats_port_table_result_cb,
-                           OVS_DB_TABLE_CB_FLAG_INITIAL |
-                           OVS_DB_TABLE_CB_FLAG_INSERT |
+      OVS_DB_TABLE_CB_FLAG_INITIAL | OVS_DB_TABLE_CB_FLAG_INSERT |
           OVS_DB_TABLE_CB_FLAG_MODIFY);
 
   ovs_db_table_cb_register(pdb, "Port", port_columns,
                            ovs_stats_port_table_delete_cb, NULL,
                            OVS_DB_TABLE_CB_FLAG_DELETE);
 
-  ovs_db_table_cb_register(pdb, "Interface", interface_columns,
-                           ovs_stats_interface_table_change_cb,
+  ovs_db_table_cb_register(
+      pdb, "Interface", interface_columns, ovs_stats_interface_table_change_cb,
       ovs_stats_interface_table_result_cb,
-                           OVS_DB_TABLE_CB_FLAG_INITIAL |
-                           OVS_DB_TABLE_CB_FLAG_INSERT |
+      OVS_DB_TABLE_CB_FLAG_INITIAL | OVS_DB_TABLE_CB_FLAG_INSERT |
           OVS_DB_TABLE_CB_FLAG_MODIFY);
 }
 
@@ -862,8 +862,8 @@ static int ovs_stats_plugin_init(void) {
        plugin_name, ovs_stats_cfg.ovs_db_node, ovs_stats_cfg.ovs_db_serv,
        ovs_stats_cfg.ovs_db_unix);
   /* connect to OvS DB */
-  if ((g_ovs_db = ovs_db_init (ovs_stats_cfg.ovs_db_node,
-                             ovs_stats_cfg.ovs_db_serv,
+  if ((g_ovs_db =
+           ovs_db_init(ovs_stats_cfg.ovs_db_node, ovs_stats_cfg.ovs_db_serv,
                        ovs_stats_cfg.ovs_db_unix, &cb)) == NULL) {
     ERROR("%s: plugin: failed to connect to OvS DB server", plugin_name);
     return -1;
index abef87c2f6b927604e614e482eb510b9d5e73e77..7c8a6158f71db7a9aff44f7c117998cb5454aea9 100644 (file)
@@ -494,7 +494,8 @@ static int av2data_set(pTHX_ AV *array, char *name, data_set_t *ds) {
  *   meta     => [ { name => <name>, value => <value> }, ... ]
  * }
  */
-static int av2notification_meta(pTHX_ AV *array, notification_meta_t **ret_meta) {
+static int av2notification_meta(pTHX_ AV *array,
+                                notification_meta_t **ret_meta) {
   notification_meta_t *tail = NULL;
 
   int len = av_len(array);
@@ -2349,14 +2350,25 @@ static int g_interval_set(pTHX_ SV *var, MAGIC *mg) {
   return 0;
 } /* static int g_interval_set (pTHX_ SV *, MAGIC *) */
 
-static MGVTBL g_pv_vtbl = {g_pv_get, g_pv_set, NULL, NULL, NULL, NULL, NULL
+static MGVTBL g_pv_vtbl = {g_pv_get,
+                           g_pv_set,
+                           NULL,
+                           NULL,
+                           NULL,
+                           NULL,
+                           NULL
 #if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL
                            ,
                            NULL
 #endif
 };
-static MGVTBL g_interval_vtbl = {g_interval_get, g_interval_set, NULL, NULL,
-                                 NULL, NULL, NULL
+static MGVTBL g_interval_vtbl = {g_interval_get,
+                                 g_interval_set,
+                                 NULL,
+                                 NULL,
+                                 NULL,
+                                 NULL,
+                                 NULL
 #if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL
                                  ,
                                  NULL
index a0a1a2717558356657998324fa4f12408c740af0..56730b47958eecf37183b466224e25d35f9498f3 100644 (file)
@@ -58,7 +58,7 @@
  * is ignored. */
 #define C_PSQL_PAR_APPEND(buf, buf_len, parameter, value)                      \
   if ((0 < (buf_len)) && (NULL != (value)) && ('\0' != *(value))) {            \
-    int s = snprintf(buf, buf_len, " %s = '%s'", parameter, value);           \
+    int s = snprintf(buf, buf_len, " %s = '%s'", parameter, value);            \
     if (0 < s) {                                                               \
       buf += s;                                                                \
       buf_len -= s;                                                            \
@@ -425,8 +425,8 @@ static PGresult *c_psql_exec_query_params(c_psql_database_t *db, udb_query_t *q,
       break;
     case C_PSQL_PARAM_INTERVAL:
       snprintf(interval, sizeof(interval), "%.3f",
-                (db->interval > 0) ? CDTIME_T_TO_DOUBLE(db->interval)
-                                   : plugin_get_interval());
+               (db->interval > 0) ? CDTIME_T_TO_DOUBLE(db->interval)
+                                  : plugin_get_interval());
       params[i] = interval;
       break;
     case C_PSQL_PARAM_INSTANCE:
@@ -438,7 +438,7 @@ static PGresult *c_psql_exec_query_params(c_psql_database_t *db, udb_query_t *q,
   }
 
   return PQexecParams(db->conn, udb_query_get_statement(q), data->params_num,
-                      NULL, (const char *const*)params, NULL, NULL, 0);
+                      NULL, (const char *const *)params, NULL, NULL, 0);
 } /* c_psql_exec_query_params */
 
 /* db->db_lock must be locked when calling this function */
@@ -670,7 +670,7 @@ static char *values_type_to_sqlarray(const data_set_t *ds, char *string,
       status = snprintf(str_ptr, str_len, ",'gauge'");
     else
       status = snprintf(str_ptr, str_len, ",'%s'",
-                         DS_TYPE_TO_STRING(ds->ds[i].type));
+                        DS_TYPE_TO_STRING(ds->ds[i].type));
 
     if (status < 1) {
       str_len = 0;
index 47f7a08a3f12d907ad81caadcab5f8b6cd4daa06..b63dee9a196def27c632556a1cb4c9021a07efcc 100644 (file)
@@ -157,7 +157,7 @@ static int read_file(const char *path) {
         char match_name[2 * DATA_MAX_NAME_LEN];
 
         snprintf(match_name, sizeof(match_name), "%s:%s", key_buffer,
-                  key_fields[i]);
+                 key_fields[i]);
 
         if (ignorelist_match(values_list, match_name))
           continue;
index b106e45cbb77e74df010716a455ed619cf3aa377..34cab885308ff0ef59b15b1ac2d1409b0a3581a2 100644 (file)
@@ -784,8 +784,8 @@ static PyObject *cpy_register_write(PyObject *self, PyObject *args,
 static PyObject *cpy_register_notification(PyObject *self, PyObject *args,
                                            PyObject *kwds) {
   return cpy_register_generic_userdata((void *)plugin_register_notification,
-                                       (void *)cpy_notification_callback,
-                                       args, kwds);
+                                       (void *)cpy_notification_callback, args,
+                                       kwds);
 }
 
 static PyObject *cpy_register_flush(PyObject *self, PyObject *args,
@@ -944,8 +944,7 @@ static PyObject *cpy_unregister_read(PyObject *self, PyObject *arg) {
 }
 
 static PyObject *cpy_unregister_write(PyObject *self, PyObject *arg) {
-  return cpy_unregister_generic_userdata(plugin_unregister_write, arg,
-                                         "write");
+  return cpy_unregister_generic_userdata(plugin_unregister_write, arg, "write");
 }
 
 static PyObject *cpy_unregister_notification(PyObject *self, PyObject *arg) {
@@ -954,8 +953,7 @@ static PyObject *cpy_unregister_notification(PyObject *self, PyObject *arg) {
 }
 
 static PyObject *cpy_unregister_flush(PyObject *self, PyObject *arg) {
-  return cpy_unregister_generic_userdata(plugin_unregister_flush, arg,
-                                         "flush");
+  return cpy_unregister_generic_userdata(plugin_unregister_flush, arg, "flush");
 }
 
 static PyObject *cpy_unregister_shutdown(PyObject *self, PyObject *arg) {
index 8e25919355a00da05a3cccbad943b6222c2597ae..fa08b3b08f3e73e62b0af50b1213822cb25336ed 100644 (file)
@@ -89,8 +89,7 @@ static void submit_interface(cr_data_t *rd, /* {{{ */
 
 static int handle_interface(__attribute__((unused))
                             ros_connection_t *c, /* {{{ */
-                            const ros_interface_t *i,
-                            void *user_data) {
+                            const ros_interface_t *i, void *user_data) {
   if ((i == NULL) || (user_data == NULL))
     return EINVAL;
 
@@ -143,7 +142,7 @@ static void submit_regtable(cr_data_t *rd, /* {{{ */
 
   /*** RX ***/
   snprintf(type_instance, sizeof(type_instance), "%s-%s-rx", r->interface,
-            r->radio_name);
+           r->radio_name);
   cr_submit_gauge(rd, "bitrate", type_instance,
                   (gauge_t)(1000000.0 * r->rx_rate));
   cr_submit_gauge(rd, "signal_power", type_instance,
@@ -152,7 +151,7 @@ static void submit_regtable(cr_data_t *rd, /* {{{ */
 
   /*** TX ***/
   snprintf(type_instance, sizeof(type_instance), "%s-%s-tx", r->interface,
-            r->radio_name);
+           r->radio_name);
   cr_submit_gauge(rd, "bitrate", type_instance,
                   (gauge_t)(1000000.0 * r->tx_rate));
   cr_submit_gauge(rd, "signal_power", type_instance,
@@ -161,7 +160,7 @@ static void submit_regtable(cr_data_t *rd, /* {{{ */
 
   /*** RX / TX ***/
   snprintf(type_instance, sizeof(type_instance), "%s-%s", r->interface,
-            r->radio_name);
+           r->radio_name);
   cr_submit_io(rd, "if_octets", type_instance, (derive_t)r->rx_bytes,
                (derive_t)r->tx_bytes);
   cr_submit_gauge(rd, "snr", type_instance, (gauge_t)r->signal_to_noise);
@@ -171,8 +170,7 @@ static void submit_regtable(cr_data_t *rd, /* {{{ */
 
 static int handle_regtable(__attribute__((unused))
                            ros_connection_t *c, /* {{{ */
-                           const ros_registration_table_t *r,
-                           void *user_data) {
+                           const ros_registration_table_t *r, void *user_data) {
   if ((r == NULL) || (user_data == NULL))
     return EINVAL;
 
index 061177351df6724660c72daea5dfe43fa2ca81ac..82870135fe0aabace9a772e357be2e4d0597d0ba 100644 (file)
@@ -89,16 +89,16 @@ static int value_list_to_string(char *buffer, int buffer_len,
 
     if (ds->ds[i].type == DS_TYPE_COUNTER) {
       status = snprintf(buffer + offset, buffer_len - offset, ":%llu",
-                         vl->values[i].counter);
+                        vl->values[i].counter);
     } else if (ds->ds[i].type == DS_TYPE_GAUGE) {
       status = snprintf(buffer + offset, buffer_len - offset, ":%f",
-                         vl->values[i].gauge);
+                        vl->values[i].gauge);
     } else if (ds->ds[i].type == DS_TYPE_DERIVE) {
       status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
-                         vl->values[i].derive);
+                        vl->values[i].derive);
     } else /* if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */ {
       status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
-                         vl->values[i].absolute);
+                        vl->values[i].absolute);
     }
 
     if ((status < 1) || (status >= (buffer_len - offset)))
index 885bcebb9ba87d27510e234e8ed4db9741b084c9..41289058c4e9f4ebe3fe7e6541dd2cf2dc5ebbbe 100644 (file)
@@ -191,16 +191,16 @@ static int value_list_to_string_multiple(char *buffer, int buffer_len,
 
     if (ds->ds[i].type == DS_TYPE_COUNTER)
       status = snprintf(buffer + offset, buffer_len - offset, ":%llu",
-                         vl->values[i].counter);
+                        vl->values[i].counter);
     else if (ds->ds[i].type == DS_TYPE_GAUGE)
       status = snprintf(buffer + offset, buffer_len - offset, ":" GAUGE_FORMAT,
-                         vl->values[i].gauge);
+                        vl->values[i].gauge);
     else if (ds->ds[i].type == DS_TYPE_DERIVE)
       status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
-                         vl->values[i].derive);
+                        vl->values[i].derive);
     else /*if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */
       status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
-                         vl->values[i].absolute);
+                        vl->values[i].absolute);
 
     if ((status < 1) || (status >= (buffer_len - offset)))
       return -1;
@@ -223,19 +223,19 @@ static int value_list_to_string(char *buffer, int buffer_len,
   switch (ds->ds[0].type) {
   case DS_TYPE_DERIVE:
     status = snprintf(buffer, buffer_len, "%u:%" PRIi64, (unsigned)tt,
-                       vl->values[0].derive);
+                      vl->values[0].derive);
     break;
   case DS_TYPE_GAUGE:
     status = snprintf(buffer, buffer_len, "%u:" GAUGE_FORMAT, (unsigned)tt,
-                       vl->values[0].gauge);
+                      vl->values[0].gauge);
     break;
   case DS_TYPE_COUNTER:
     status = snprintf(buffer, buffer_len, "%u:%llu", (unsigned)tt,
-                       vl->values[0].counter);
+                      vl->values[0].counter);
     break;
   case DS_TYPE_ABSOLUTE:
     status = snprintf(buffer, buffer_len, "%u:%" PRIu64, (unsigned)tt,
-                       vl->values[0].absolute);
+                      vl->values[0].absolute);
     break;
   default:
     return EINVAL;
index 27739330cb09f11887911254f7215e8fa2769268..f4ecda5e49e0f12114ea32ccc2260a31789b4ad4 100644 (file)
@@ -437,7 +437,7 @@ static void sensors_submit(const char *plugin_instance, const char *type,
   value_list_t vl = VALUE_LIST_INIT;
 
   status = snprintf(match_key, sizeof(match_key), "%s/%s-%s", plugin_instance,
-                     type, type_instance);
+                    type, type_instance);
   if (status < 1)
     return;
 
index 6d4cb976ceaa6e220be1371ac1ce85e6ddcaff73..8a325fe9f07006d4e68526696bde2ed954ffedc2 100644 (file)
@@ -248,9 +248,9 @@ static int sigrok_init_driver(struct config_device *cfdev,
   cfdev->sdi = devlist->data;
   g_slist_free(devlist);
   snprintf(hwident, sizeof(hwident), "%s %s %s",
-            cfdev->sdi->vendor ? cfdev->sdi->vendor : "",
-            cfdev->sdi->model ? cfdev->sdi->model : "",
-            cfdev->sdi->version ? cfdev->sdi->version : "");
+           cfdev->sdi->vendor ? cfdev->sdi->vendor : "",
+           cfdev->sdi->model ? cfdev->sdi->model : "",
+           cfdev->sdi->version ? cfdev->sdi->version : "");
   INFO("sigrok plugin: Device \"%s\" is a %s", cfdev->name, hwident);
 
   if (sr_dev_open(cfdev->sdi) != SR_OK)
index f5850f5f4d12269156e038e2b7860b5a89594239..30680be6ed4b5d0565ea27a4a46c453e3f3c1051 100644 (file)
@@ -117,8 +117,8 @@ static void handle_attribute(SkDisk *d, const SkSmartAttributeParsedData *a,
     sstrncpy(notif.plugin_instance, name, sizeof(notif.plugin_instance));
     sstrncpy(notif.type_instance, a->name, sizeof(notif.type_instance));
     snprintf(notif.message, sizeof(notif.message),
-              "attribute %s is below allowed threshold (%d < %d)", a->name,
-              a->current_value, a->threshold);
+             "attribute %s is below allowed threshold (%d < %d)", a->name,
+             a->current_value, a->threshold);
     plugin_dispatch_notification(&notif);
   }
 }
index ae2b0d46db1166bab01dae22d04d6ed92bd303fa..c299db9634406b45e8697572722c852d571bcaa4 100644 (file)
@@ -130,8 +130,7 @@ static void csnmp_oid_init(oid_t *dst, oid const *src, size_t n) {
 }
 
 static int csnmp_oid_compare(oid_t const *left, oid_t const *right) {
-  return snmp_oid_compare(left->oid, left->oid_len, right->oid,
-                          right->oid_len);
+  return snmp_oid_compare(left->oid, left->oid_len, right->oid, right->oid_len);
 }
 
 static int csnmp_oid_suffix(oid_t *dst, oid_t const *src, oid_t const *root) {
@@ -998,9 +997,9 @@ static int csnmp_strvbcopy(char *dst, /* {{{ */
     src = (char *)vb->val.bitstring;
   else if (vb->type == ASN_IPADDRESS) {
     return snprintf(dst, dst_size,
-                     "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "",
-                     (uint8_t)vb->val.string[0], (uint8_t)vb->val.string[1],
-                     (uint8_t)vb->val.string[2], (uint8_t)vb->val.string[3]);
+                    "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "",
+                    (uint8_t)vb->val.string[0], (uint8_t)vb->val.string[1],
+                    (uint8_t)vb->val.string[2], (uint8_t)vb->val.string[3]);
   } else {
     dst[0] = 0;
     return EINVAL;
@@ -1223,7 +1222,7 @@ static int csnmp_dispatch_table(host_definition_t *host,
         sstrncpy(vl.type_instance, temp, sizeof(vl.type_instance));
       else
         snprintf(vl.type_instance, sizeof(vl.type_instance), "%s%s",
-                  data->instance_prefix, temp);
+                 data->instance_prefix, temp);
     }
 
     vl.values_len = data->values_len;
index 8441601b098a8c496d2abd7882c459fce6ee0001..83cb8e33321e1dec6360d5e47172c8c3fb97a1ad 100644 (file)
@@ -282,7 +282,8 @@ static int snmp_agent_validate_data(void) {
   return 0;
 }
 
-static void snmp_agent_generate_oid2string(oid_t *oid, size_t offset, char *key) {
+static void snmp_agent_generate_oid2string(oid_t *oid, size_t offset,
+                                           char *key) {
   int key_len = oid->oid[offset];
   int i;
 
@@ -369,8 +370,8 @@ static int snmp_agent_table_row_remove(table_definition_t *td,
   sstrncpy(n.host, hostname_g, sizeof(n.host));
   sstrncpy(n.plugin_instance, ins, sizeof(n.plugin_instance));
   snprintf(n.message, sizeof(n.message),
-            "Removed data row from table %s instance %s index %d", td->name,
-            ins, (index != NULL) ? *index : -1);
+           "Removed data row from table %s instance %s index %d", td->name, ins,
+           (index != NULL) ? *index : -1);
   plugin_dispatch_notification(&n);
 
   if (td->index_oid.oid_len) {
@@ -616,9 +617,9 @@ snmp_agent_table_oid_handler(struct netsnmp_mib_handler_s *handler,
 
         if (dd->is_instance) {
           requests->requestvb->type = ASN_OCTET_STR;
-          snmp_set_var_typed_value(requests->requestvb,
-                                   requests->requestvb->type, (const u_char *)instance,
-                                   strlen((instance)));
+          snmp_set_var_typed_value(
+              requests->requestvb, requests->requestvb->type,
+              (const u_char *)instance, strlen((instance)));
 
           pthread_mutex_unlock(&g_agent->lock);
 
@@ -1306,8 +1307,8 @@ static int snmp_agent_update_index(table_definition_t *td,
   sstrncpy(n.host, hostname_g, sizeof(n.host));
   sstrncpy(n.plugin_instance, ins, sizeof(n.plugin_instance));
   snprintf(n.message, sizeof(n.message),
-            "Data row added to table %s instance %s index %d", td->name, ins,
-            (index != NULL) ? *index : -1);
+           "Data row added to table %s instance %s index %d", td->name, ins,
+           (index != NULL) ? *index : -1);
   plugin_dispatch_notification(&n);
 
   return 0;
index 3310bc45f22fe366bf8dece8fc937993b8a0ef7c..5142613739e9c77f2542d64b352752af9ad7eb3c 100644 (file)
@@ -605,8 +605,9 @@ static int statsd_config_timer_percentile(oconfig_item_t *ci) /* {{{ */
     return ERANGE;
   }
 
-  tmp = realloc(conf_timer_percentile, sizeof(*conf_timer_percentile) *
-                                           (conf_timer_percentile_num + 1));
+  tmp =
+      realloc(conf_timer_percentile,
+              sizeof(*conf_timer_percentile) * (conf_timer_percentile_num + 1));
   if (tmp == NULL) {
     ERROR("statsd plugin: realloc failed.");
     return ENOMEM;
@@ -766,8 +767,8 @@ static int statsd_metric_submit_unsafe(char const *name,
     }
 
     for (size_t i = 0; i < conf_timer_percentile_num; i++) {
-      snprintf(vl.type_instance, sizeof(vl.type_instance),
-                "%s-percentile-%.0f", name, conf_timer_percentile[i]);
+      snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-percentile-%.0f",
+               name, conf_timer_percentile[i]);
       vl.values[0].gauge =
           have_events ? CDTIME_T_TO_DOUBLE(latency_counter_get_percentile(
                             metric->latency, conf_timer_percentile[i]))
index 746ba51a110c594275393f04e72d6f7198673c80..a5531c24e86247532ca68323cc1200818e9eebc2 100644 (file)
@@ -410,7 +410,7 @@ static int swap_read(void) /* {{{ */
 
   return 0;
 } /* }}} int swap_read */
-  /* #endif KERNEL_LINUX */
+/* #endif KERNEL_LINUX */
 
 /*
  * Under Solaris, two mechanisms can be used to read swap statistics, swapctl
index 55de164bc42a7e9d890d12cedb09c2da92477c17..90a97fb52fff8a27598332f60ac3a2525e945086 100644 (file)
@@ -107,7 +107,7 @@ static int sl_notification(const notification_t *n,
 
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
-    status = snprintf(&buf[offset], sizeof(buf) - offset, __VA_ARGS__);       \
+    status = snprintf(&buf[offset], sizeof(buf) - offset, __VA_ARGS__);        \
     if (status < 1)                                                            \
       return -1;                                                               \
     else if (((size_t)status) >= (sizeof(buf) - offset))                       \
index ffd76dc552e406a9b91f22e73bd0599e7e4e7798..429e256dbf32369e57c4a2cb668807c5757de794 100644 (file)
@@ -234,7 +234,7 @@ static int tn_invoke(const data_set_t *ds, value_list_t *vl, /* {{{ */
     /* If this is a gauge value, use the current value. */
     if (ds->ds[i].type == DS_TYPE_GAUGE)
       snprintf(value_str, sizeof(value_str), GAUGE_FORMAT,
-                (double)vl->values[i].gauge);
+               (double)vl->values[i].gauge);
     /* If it's a counter, try to use the current rate. This may fail, if the
      * value has been renamed. */
     else if (rates != NULL)
index e58bf1806192c60648d69eb3453b3164690ee932..1cc5d793d956e6a656b2896d719908acc6fd139e 100644 (file)
@@ -57,11 +57,11 @@ static int ts_invoke_counter(const data_set_t *ds, value_list_t *vl, /* {{{ */
   curr_counter = (uint64_t)vl->values[dsrc_index].counter;
 
   snprintf(key_prev_counter, sizeof(key_prev_counter),
-            "target_scale[%p,%i]:prev_counter", (void *)data, dsrc_index);
+           "target_scale[%p,%i]:prev_counter", (void *)data, dsrc_index);
   snprintf(key_int_counter, sizeof(key_int_counter),
-            "target_scale[%p,%i]:int_counter", (void *)data, dsrc_index);
+           "target_scale[%p,%i]:int_counter", (void *)data, dsrc_index);
   snprintf(key_int_fraction, sizeof(key_int_fraction),
-            "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
+           "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
 
   prev_counter = curr_counter;
   int_counter = 0;
@@ -150,11 +150,11 @@ static int ts_invoke_derive(const data_set_t *ds, value_list_t *vl, /* {{{ */
   curr_derive = (int64_t)vl->values[dsrc_index].derive;
 
   snprintf(key_prev_derive, sizeof(key_prev_derive),
-            "target_scale[%p,%i]:prev_derive", (void *)data, dsrc_index);
+           "target_scale[%p,%i]:prev_derive", (void *)data, dsrc_index);
   snprintf(key_int_derive, sizeof(key_int_derive),
-            "target_scale[%p,%i]:int_derive", (void *)data, dsrc_index);
+           "target_scale[%p,%i]:int_derive", (void *)data, dsrc_index);
   snprintf(key_int_fraction, sizeof(key_int_fraction),
-            "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
+           "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
 
   prev_derive = curr_derive;
   int_derive = 0;
@@ -233,7 +233,7 @@ static int ts_invoke_absolute(const data_set_t *ds, value_list_t *vl, /* {{{ */
   curr_absolute = (uint64_t)vl->values[dsrc_index].absolute;
 
   snprintf(key_int_fraction, sizeof(key_int_fraction),
-            "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
+           "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
 
   int_fraction = 0.0;
 
index 34083b6dbebb97fdf8bdcffd0eb4a947e17131ee..49f09f083cc81540bd701dd34eb3ead06847aaaa 100644 (file)
@@ -238,23 +238,23 @@ static int v5_zfs_arc_counts(const data_set_t *ds, value_list_t *vl) /* {{{ */
 
   /* Dispatch new value lists instead of this one */
   new_vl.values[0].derive = (derive_t)vl->values[0].counter;
-  snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
-            "demand_data-%s", is_hits ? "hit" : "miss");
+  snprintf(new_vl.type_instance, sizeof(new_vl.type_instance), "demand_data-%s",
+           is_hits ? "hit" : "miss");
   plugin_dispatch_values(&new_vl);
 
   new_vl.values[0].derive = (derive_t)vl->values[1].counter;
   snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
-            "demand_metadata-%s", is_hits ? "hit" : "miss");
+           "demand_metadata-%s", is_hits ? "hit" : "miss");
   plugin_dispatch_values(&new_vl);
 
   new_vl.values[0].derive = (derive_t)vl->values[2].counter;
   snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
-            "prefetch_data-%s", is_hits ? "hit" : "miss");
+           "prefetch_data-%s", is_hits ? "hit" : "miss");
   plugin_dispatch_values(&new_vl);
 
   new_vl.values[0].derive = (derive_t)vl->values[3].counter;
   snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
-            "prefetch_metadata-%s", is_hits ? "hit" : "miss");
+           "prefetch_metadata-%s", is_hits ? "hit" : "miss");
   plugin_dispatch_values(&new_vl);
 
   /* Abort processing */
index 732e4479c4af31d44de1e09b590db7b5a0960d10..9fdd16e9c1b30b7d336c18e0b3620c8a587340e4 100644 (file)
@@ -70,7 +70,8 @@
 #undef HAVE_SYSCTLBYNAME /* force HAVE_LIBKVM_NLIST path */
 #endif
 
-#if !KERNEL_LINUX && !HAVE_SYSCTLBYNAME && !HAVE_KVM_GETFILES && !HAVE_LIBKVM_NLIST && !KERNEL_AIX
+#if !KERNEL_LINUX && !HAVE_SYSCTLBYNAME && !HAVE_KVM_GETFILES &&               \
+    !HAVE_LIBKVM_NLIST && !KERNEL_AIX
 #error "No applicable input method."
 #endif
 
 /* #endif HAVE_SYSCTLBYNAME */
 
 #elif HAVE_KVM_GETFILES
-#include <sys/types.h>
 #include <sys/sysctl.h>
+#include <sys/types.h>
 #define _KERNEL /* for DTYPE_SOCKET */
 #include <sys/file.h>
 #undef _KERNEL
 #include <net/route.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#include <netinet/ip.h>
 #include <netinet/in_pcb.h>
 #include <netinet/in_systm.h>
+#include <netinet/ip.h>
 #include <netinet/ip_var.h>
 #include <netinet/tcp.h>
 #include <netinet/tcp_timer.h>
@@ -293,7 +294,7 @@ static void conn_submit_port_entry(port_entry_t *pe) {
   if (((port_collect_listening != 0) && (pe->flags & PORT_IS_LISTENING)) ||
       (pe->flags & PORT_COLLECT_LOCAL)) {
     snprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
-              "%" PRIu16 "-local", pe->port);
+             "%" PRIu16 "-local", pe->port);
 
     for (int i = 1; i <= TCP_STATE_MAX; i++) {
       vl.values[0].gauge = pe->count_local[i];
@@ -306,7 +307,7 @@ static void conn_submit_port_entry(port_entry_t *pe) {
 
   if (pe->flags & PORT_COLLECT_REMOTE) {
     snprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
-              "%" PRIu16 "-remote", pe->port);
+             "%" PRIu16 "-remote", pe->port);
 
     for (int i = 1; i <= TCP_STATE_MAX; i++) {
       vl.values[0].gauge = pe->count_remote[i];
@@ -830,8 +831,7 @@ static int conn_read(void) {
 
   conn_reset_port_entry();
 
-  kf = kvm_getfiles(kvmd, KERN_FILE_BYFILE, DTYPE_SOCKET,
-                   sizeof(*kf), &fcnt);
+  kf = kvm_getfiles(kvmd, KERN_FILE_BYFILE, DTYPE_SOCKET, sizeof(*kf), &fcnt);
   if (kf == NULL) {
     ERROR("tcpconns plugin: kvm_getfiles failed.");
     return -1;
index 12c275329708035e63e4d19de0028db2cd09563a..4d68f61f0ee4f21865e2573452a7318de10cb1b5 100644 (file)
@@ -464,7 +464,7 @@ static int tss2_read_vserver(vserver_list_t *vserver) {
   } else {
     /* Request server information */
     snprintf(plugin_instance, sizeof(plugin_instance), "vserver%i",
-              vserver->port);
+             vserver->port);
 
     /* Select the server */
     status = tss2_select_vserver(read_fh, write_fh, vserver);
index 456ae879d28527050c01018de988c4e9774a99bd..9da8fa5fbb1d92c7a9d80b9defbce04b3f10fdf0 100644 (file)
@@ -99,7 +99,7 @@ static int thermal_procfs_device_read(const char __attribute__((unused)) * dir,
    */
 
   len = snprintf(filename, sizeof(filename), "%s/%s/temperature",
-                  dirname_procfs, name);
+                 dirname_procfs, name);
   if ((len < 0) || ((size_t)len >= sizeof(filename)))
     return -1;
 
index f2407d2875579bc89a95ae236c01a58d3c213118..790013344b964288cb8826eb1118b6237d51b147 100644 (file)
@@ -356,9 +356,9 @@ static int ut_config_host(const threshold_t *th_orig, oconfig_item_t *ci) {
 
   return status;
 } /* int ut_config_host */
-  /*
  * End of the functions used to configure threshold values.
  */
+/*
+ * End of the functions used to configure threshold values.
+ */
 /* }}} */
 
 /*
@@ -457,8 +457,8 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl,
       snprintf(buf, bufsize, ": Value is no longer missing.");
     else
       snprintf(buf, bufsize, ": All data sources are within range again. "
-                              "Current value of \"%s\" is %f.",
-                ds->ds[ds_index].name, values[ds_index]);
+                             "Current value of \"%s\" is %f.",
+               ds->ds[ds_index].name, values[ds_index]);
   } else {
     double min;
     double max;
@@ -469,20 +469,20 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl,
     if (th->flags & UT_FLAG_INVERT) {
       if (!isnan(min) && !isnan(max)) {
         snprintf(buf, bufsize,
-                  ": Data source \"%s\" is currently "
-                  "%f. That is within the %s region of %f%s and %f%s.",
-                  ds->ds[ds_index].name, values[ds_index],
-                  (state == STATE_ERROR) ? "failure" : "warning", min,
-                  ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "", max,
-                  ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
+                 ": Data source \"%s\" is currently "
+                 "%f. That is within the %s region of %f%s and %f%s.",
+                 ds->ds[ds_index].name, values[ds_index],
+                 (state == STATE_ERROR) ? "failure" : "warning", min,
+                 ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "", max,
+                 ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
       } else {
         snprintf(buf, bufsize, ": Data source \"%s\" is currently "
-                                "%f. That is %s the %s threshold of %f%s.",
-                  ds->ds[ds_index].name, values[ds_index],
-                  isnan(min) ? "below" : "above",
-                  (state == STATE_ERROR) ? "failure" : "warning",
-                  isnan(min) ? max : min,
-                  ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
+                               "%f. That is %s the %s threshold of %f%s.",
+                 ds->ds[ds_index].name, values[ds_index],
+                 isnan(min) ? "below" : "above",
+                 (state == STATE_ERROR) ? "failure" : "warning",
+                 isnan(min) ? max : min,
+                 ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
       }
     } else if (th->flags & UT_FLAG_PERCENTAGE) {
       gauge_t value;
@@ -502,20 +502,20 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl,
         value = 100.0 * values[ds_index] / sum;
 
       snprintf(buf, bufsize,
-                ": Data source \"%s\" is currently "
-                "%g (%.2f%%). That is %s the %s threshold of %.2f%%.",
-                ds->ds[ds_index].name, values[ds_index], value,
-                (value < min) ? "below" : "above",
-                (state == STATE_ERROR) ? "failure" : "warning",
-                (value < min) ? min : max);
+               ": Data source \"%s\" is currently "
+               "%g (%.2f%%). That is %s the %s threshold of %.2f%%.",
+               ds->ds[ds_index].name, values[ds_index], value,
+               (value < min) ? "below" : "above",
+               (state == STATE_ERROR) ? "failure" : "warning",
+               (value < min) ? min : max);
     } else /* is not inverted */
     {
       snprintf(buf, bufsize, ": Data source \"%s\" is currently "
-                              "%f. That is %s the %s threshold of %f.",
-                ds->ds[ds_index].name, values[ds_index],
-                (values[ds_index] < min) ? "below" : "above",
-                (state == STATE_ERROR) ? "failure" : "warning",
-                (values[ds_index] < min) ? min : max);
+                             "%f. That is %s the %s threshold of %f.",
+               ds->ds[ds_index].name, values[ds_index],
+               (values[ds_index] < min) ? "below" : "above",
+               (state == STATE_ERROR) ? "failure" : "warning",
+               (values[ds_index] < min) ? min : max);
     }
   }
 
@@ -773,8 +773,8 @@ static int ut_missing(const value_list_t *vl,
 
   NOTIFICATION_INIT_VL(&n, vl);
   snprintf(n.message, sizeof(n.message),
-            "%s has not been updated for %.3f seconds.", identifier,
-            CDTIME_T_TO_DOUBLE(missing_time));
+           "%s has not been updated for %.3f seconds.", identifier,
+           CDTIME_T_TO_DOUBLE(missing_time));
   n.time = now;
 
   plugin_dispatch_notification(&n);
index 73a6769be44a80a75786fa8b99fdddefe0e4e39e..1049fb2ad3ce0803254e0cb35c8381a40234e86a 100644 (file)
@@ -567,9 +567,9 @@ static int submit_counters(struct thread_data *t, struct core_data *c,
                    1.0 / 1000000 * t->aperf / interval_float);
 
   if ((!aperf_mperf_unstable) || (!(t->aperf > t->tsc || t->mperf > t->tsc)))
-    turbostat_submit(name, "frequency", "busy", 1.0 * t->tsc / 1000000 *
-                                                    t->aperf / t->mperf /
-                                                    interval_float);
+    turbostat_submit(name, "frequency", "busy",
+                     1.0 * t->tsc / 1000000 * t->aperf / t->mperf /
+                         interval_float);
 
   /* Sanity check (should stay stable) */
   turbostat_submit(name, "gauge", "TSC",
@@ -1065,7 +1065,7 @@ static int get_threads_on_core(unsigned int cpu) {
   char character;
 
   snprintf(path, sizeof(path),
-            "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
+           "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
   filep = fopen(path, "r");
   if (!filep) {
     ERROR("turbostat plugin: Failed to open '%s'", path);
index aadc214e2ac845277c7e633b54df0f8d1f1000c8..6f1bc39ed489dcb9f60d9467ba60b370dd6ac9c0 100644 (file)
@@ -277,9 +277,9 @@ int cmd_create_putval(char *ret, size_t ret_len, /* {{{ */
   escape_string(buffer_values, sizeof(buffer_values));
 
   snprintf(ret, ret_len, "PUTVAL %s interval=%.3f %s", buffer_ident,
-            (vl->interval > 0) ? CDTIME_T_TO_DOUBLE(vl->interval)
-                               : CDTIME_T_TO_DOUBLE(plugin_get_interval()),
-            buffer_values);
+           (vl->interval > 0) ? CDTIME_T_TO_DOUBLE(vl->interval)
+                              : CDTIME_T_TO_DOUBLE(plugin_get_interval()),
+           buffer_values);
 
   return 0;
 } /* }}} int cmd_create_putval */
index 97702251e18458e1cc5cfd5944bef5b769d8d060..055c987c03c6741444570db0e74681fca98585b5 100644 (file)
  *   Sebastian 'tokkee' Harl <sh at tokkee.org>
  **/
 
+#include "utils_cmds.h"
 #include "daemon/common.h"
 #include "utils_cmd_flush.h"
 #include "utils_cmd_getval.h"
 #include "utils_cmd_listval.h"
 #include "utils_cmd_putval.h"
-#include "utils_cmds.h"
 #include "utils_parse_option.h"
 
 #include <stdbool.h>
index 4911c80920d461931f5a937387afe961cace0d4d..4b246c9ecb870b19c2d9d3d588346556776c1ffe 100644 (file)
@@ -107,7 +107,7 @@ static void dpdk_helper_config_default(dpdk_helper_ctx_t *phc) {
   snprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
   snprintf(phc->eal_config.process_type, DATA_MAX_NAME_LEN, "%s", "secondary");
   snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "%s",
-            DPDK_DEFAULT_RTE_CONFIG);
+           DPDK_DEFAULT_RTE_CONFIG);
 }
 
 int dpdk_helper_eal_config_set(dpdk_helper_ctx_t *phc, dpdk_eal_config_t *ec) {
@@ -183,7 +183,7 @@ int dpdk_helper_eal_config_parse(dpdk_helper_ctx_t *phc, oconfig_item_t *ci) {
     } else if ((strcasecmp("FilePrefix", child->key) == 0) &&
                (child->values[0].type == OCONFIG_TYPE_STRING)) {
       snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
-                "/var/run/.%s_config", child->values[0].value.string);
+               "/var/run/.%s_config", child->values[0].value.string);
       DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
     } else {
       ERROR("dpdk_common: Invalid '%s' configuration option", child->key);
index a247f28b048f0e8f06cfdeef5e6d66c5f955acf6..87cead14cb5cc01f63df430715d9a35749f0938c 100644 (file)
@@ -46,7 +46,7 @@ static int gr_format_values(char *ret, size_t ret_len, int ds_num,
 
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
-    status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__);           \
+    status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__);            \
     if (status < 1) {                                                          \
       return -1;                                                               \
     } else if (((size_t)status) >= (ret_len - offset)) {                       \
@@ -132,8 +132,8 @@ static int gr_format_name(char *ret, int ret_len, value_list_t const *vl,
 
   if (n_plugin_instance[0] != '\0')
     snprintf(tmp_plugin, sizeof(tmp_plugin), "%s%c%s", n_plugin,
-              (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
-              n_plugin_instance);
+             (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
+             n_plugin_instance);
   else
     sstrncpy(tmp_plugin, n_plugin, sizeof(tmp_plugin));
 
@@ -142,8 +142,8 @@ static int gr_format_name(char *ret, int ret_len, value_list_t const *vl,
       sstrncpy(tmp_type, n_type_instance, sizeof(tmp_type));
     else
       snprintf(tmp_type, sizeof(tmp_type), "%s%c%s", n_type,
-                (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
-                n_type_instance);
+               (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
+               n_type_instance);
   } else
     sstrncpy(tmp_type, n_type, sizeof(tmp_type));
 
@@ -153,13 +153,13 @@ static int gr_format_name(char *ret, int ret_len, value_list_t const *vl,
     if ((flags & GRAPHITE_DROP_DUPE_FIELDS) &&
         strcmp(tmp_plugin, tmp_type) == 0)
       snprintf(ret, ret_len, "%s%s%s.%s.%s", prefix, n_host, postfix,
-                tmp_plugin, ds_name);
+               tmp_plugin, ds_name);
     else
       snprintf(ret, ret_len, "%s%s%s.%s.%s.%s", prefix, n_host, postfix,
-                tmp_plugin, tmp_type, ds_name);
+               tmp_plugin, tmp_type, ds_name);
   } else
     snprintf(ret, ret_len, "%s%s%s.%s.%s", prefix, n_host, postfix, tmp_plugin,
-              tmp_type);
+             tmp_type);
 
   return 0;
 }
@@ -220,7 +220,7 @@ int format_graphite(char *buffer, size_t buffer_size, data_set_t const *ds,
     /* Compute the graphite command */
     message_len =
         (size_t)snprintf(message, sizeof(message), "%s %s %u\r\n", key, values,
-                          (unsigned int)CDTIME_T_TO_TIME_T(vl->time));
+                         (unsigned int)CDTIME_T_TO_TIME_T(vl->time));
     if (message_len >= sizeof(message)) {
       ERROR("format_graphite: message buffer too small: "
             "Need %zu bytes.",
index d685390d3f953f841eb28d81be89a523d011412b..53a38b89118a04ceea0f4d9d2a430d9feb87e6af 100644 (file)
@@ -95,7 +95,7 @@ static int values_to_json(char *buffer, size_t buffer_size, /* {{{ */
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
     int status;                                                                \
-    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);    \
+    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);     \
     if (status < 1) {                                                          \
       sfree(rates);                                                            \
       return -1;                                                               \
@@ -159,7 +159,7 @@ static int dstypes_to_json(char *buffer, size_t buffer_size, /* {{{ */
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
     int status;                                                                \
-    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);    \
+    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);     \
     if (status < 1)                                                            \
       return -1;                                                               \
     else if (((size_t)status) >= (buffer_size - offset))                       \
@@ -193,7 +193,7 @@ static int dsnames_to_json(char *buffer, size_t buffer_size, /* {{{ */
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
     int status;                                                                \
-    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);    \
+    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);     \
     if (status < 1)                                                            \
       return -1;                                                               \
     else if (((size_t)status) >= (buffer_size - offset))                       \
@@ -228,7 +228,7 @@ static int meta_data_keys_to_json(char *buffer, size_t buffer_size, /* {{{ */
 
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
-    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);    \
+    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);     \
     if (status < 1)                                                            \
       return -1;                                                               \
     else if (((size_t)status) >= (buffer_size - offset))                       \
@@ -318,7 +318,7 @@ static int value_list_to_json(char *buffer, size_t buffer_size, /* {{{ */
 
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
-    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);    \
+    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);     \
     if (status < 1)                                                            \
       return -1;                                                               \
     else if (((size_t)status) >= (buffer_size - offset))                       \
@@ -577,11 +577,12 @@ static int format_alert(yajl_gen g, notification_t const *n) /* {{{ */
   }
 
   JSON_ADD(g, "severity");
-  JSON_ADD(g, (n->severity == NOTIF_FAILURE)
-                  ? "FAILURE"
-                  : (n->severity == NOTIF_WARNING)
-                        ? "WARNING"
-                        : (n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN");
+  JSON_ADD(g,
+           (n->severity == NOTIF_FAILURE)
+               ? "FAILURE"
+               : (n->severity == NOTIF_WARNING)
+                     ? "WARNING"
+                     : (n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN");
 
   JSON_ADD(g, "service");
   JSON_ADD(g, "collectd");
index b344d183b3ac349192bfe80bb6c03e34575eae6f..0128c575e37c167093c66ac28b9b715b17822908 100644 (file)
@@ -103,7 +103,7 @@ static int values_to_kairosdb(char *buffer, size_t buffer_size, /* {{{ */
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
     int status;                                                                \
-    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);    \
+    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);     \
     if (status < 1) {                                                          \
       sfree(rates);                                                            \
       return -1;                                                               \
@@ -192,7 +192,7 @@ static int value_list_to_kairosdb(char *buffer, size_t buffer_size, /* {{{ */
 
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
-    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);    \
+    status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__);     \
     if (status < 1)                                                            \
       return -1;                                                               \
     else if (((size_t)status) >= (buffer_size - offset))                       \
@@ -345,12 +345,9 @@ int format_kairosdb_value_list(char *buffer, /* {{{ */
   if (*ret_buffer_free < 3)
     return -ENOMEM;
 
-  return format_kairosdb_value_list_nocheck(buffer, ret_buffer_fill,
-                                            ret_buffer_free, ds, vl,
-                                            store_rates,
-                                            (*ret_buffer_free) - 2,
-                                            http_attrs, http_attrs_num,
-                                            data_ttl);
+  return format_kairosdb_value_list_nocheck(
+      buffer, ret_buffer_fill, ret_buffer_free, ds, vl, store_rates,
+      (*ret_buffer_free) - 2, http_attrs, http_attrs_num, data_ttl);
 } /* }}} int format_kairosdb_value_list */
 
 /* vim: set sw=2 sts=2 et fdm=marker : */
index d0832cbcfd93e0f8e19a495bb35f17d68ffa6a37..0f8c2a269e088b6c97800b87019f1876028b8a32 100644 (file)
@@ -25,8 +25,8 @@
  *   Pavel Rochnyack <pavel2000 at ngs.ru>
  */
 
-#include "common.h"
 #include "utils_latency_config.h"
+#include "common.h"
 #include "collectd.h"
 
 static int latency_config_add_percentile(latency_config_t *conf,
index 4e570ff3c7c703d510361cc84b1c7283b7e7b250..0990472bd6740c4b21fe7d4bbbef60eda2b2d600 100644 (file)
@@ -28,8 +28,8 @@
  * GCC will complain about the macro definition. */
 #define DONT_POISON_SPRINTF_YET
 
-#include "common.h"
 #include "utils_lua.h"
+#include "common.h"
 
 static int ltoc_values(lua_State *L, /* {{{ */
                        const data_set_t *ds, value_t *ret_values) {
index e5ddcaf890e97d70a99814005acff2e3a95f262e..3d57ca64e732252365d3ca142ad655519d3d7e30 100644 (file)
@@ -527,7 +527,7 @@ static cu_mount_t *cu_mount_gen_getmntent(void) {
 
   return first;
 } /* static cu_mount_t *cu_mount_gen_getmntent (void) */
-/* #endif HAVE_TWO_GETMNTENT || HAVE_GEN_GETMNTENT || HAVE_SUN_GETMNTENT */
+  /* #endif HAVE_TWO_GETMNTENT || HAVE_GEN_GETMNTENT || HAVE_SUN_GETMNTENT */
 
 #elif HAVE_SEQ_GETMNTENT
 #warn "This version of `getmntent' hat not yet been implemented!"
index 67b9f8f0d54a9cc5aa574c5e2c38bf159182f75a..2087324721f484d4ed74ca8c98ec56dc9f11de41 100644 (file)
@@ -3,14 +3,17 @@
  *
  * Copyright(c) 2016 Intel Corporation. All rights reserved.
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ *of
  * this software and associated documentation files (the "Software"), to deal in
  * the Software without restriction, including without limitation the rights to
  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
+ * of the Software, and to permit persons to whom the Software is furnished to
+ *do
  * so, subject to the following conditions:
  *
- * The above copyright notice and this permission notice shall be included in all
+ * The above copyright notice and this permission notice shall be included in
+ *all
  * copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@@ -314,8 +317,7 @@ static int ovs_db_data_send(const ovs_db_t *pdb, const char *data, size_t len) {
  */
 static yajl_gen_status ovs_yajl_gen_tstring(yajl_gen hander,
                                             const char *string) {
-  return yajl_gen_string(hander, (const unsigned char *)string,
-                         strlen(string));
+  return yajl_gen_string(hander, (const unsigned char *)string, strlen(string));
 }
 
 /* Add YAJL value into YAJL generator handle (JSON object)
index 1448cc5119eda7aacb28b170fbd45b64407ad9a7..6cb544637aa5c3e7a3d1d7075e4a038a9123907b 100644 (file)
@@ -209,7 +209,7 @@ static int rra_get(char ***ret, const value_list_t *vl, /* {{{ */
         break;
 
       status = snprintf(buffer, sizeof(buffer), "RRA:%s:%.10f:%u:%u",
-                         rra_types[j], cfg->xff, cdp_len, cdp_num);
+                        rra_types[j], cfg->xff, cdp_len, cdp_num);
 
       if ((status < 0) || ((size_t)status >= sizeof(buffer))) {
         ERROR("rra_get: Buffer would have been truncated.");
@@ -287,11 +287,11 @@ static int ds_get(char ***ret, /* {{{ */
     } else
       snprintf(max, sizeof(max), "%f", d->max);
 
-    status = snprintf(buffer, sizeof(buffer), "DS:%s:%s:%i:%s:%s", d->name,
-                       type, (cfg->heartbeat > 0)
-                                 ? cfg->heartbeat
-                                 : (int)CDTIME_T_TO_TIME_T(2 * vl->interval),
-                       min, max);
+    status = snprintf(
+        buffer, sizeof(buffer), "DS:%s:%s:%i:%s:%s", d->name, type,
+        (cfg->heartbeat > 0) ? cfg->heartbeat
+                             : (int)CDTIME_T_TO_TIME_T(2 * vl->interval),
+        min, max);
     if ((status < 1) || ((size_t)status >= sizeof(buffer)))
       break;
 
index a3f0ec11caeb57c32ea1d7e5084d8dd24283738f..af8bbe7c2dcad17b152cd460ff06083fafee73e2 100644 (file)
@@ -120,10 +120,10 @@ static int latency_submit_match(cu_match_t *match, void *user_data) {
   for (size_t i = 0; i < data->latency_config.percentile_num; i++) {
     if (strlen(data->type_instance) != 0)
       snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%.0f",
-                data->type_instance, data->latency_config.percentile[i]);
+               data->type_instance, data->latency_config.percentile[i]);
     else
       snprintf(vl.type_instance, sizeof(vl.type_instance), "%.0f",
-                data->latency_config.percentile[i]);
+               data->latency_config.percentile[i]);
 
     vl.values = &(value_t){
         .gauge =
@@ -148,10 +148,10 @@ static int latency_submit_match(cu_match_t *match, void *user_data) {
 
     if (strlen(data->type_instance) != 0)
       snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s-%g_%g",
-                data->type, data->type_instance, lower_bound, upper_bound);
+               data->type, data->type_instance, lower_bound, upper_bound);
     else
       snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%g_%g",
-                data->type, lower_bound, upper_bound);
+               data->type, lower_bound, upper_bound);
 
     vl.values = &(value_t){
         .gauge =
index 90dd4e943ad30dd46c04959d9eef023eaf46b572..7c5a9ef07fa980adc102d57356da3b9b4b50259c 100644 (file)
@@ -99,7 +99,7 @@ static int varnish_submit(const char *plugin_instance, /* {{{ */
   if (plugin_instance == NULL)
     plugin_instance = "default";
   snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
-            plugin_instance, category);
+           plugin_instance, category);
 
   sstrncpy(vl.type, type, sizeof(vl.type));
 
@@ -113,18 +113,20 @@ static int varnish_submit_gauge(const char *plugin_instance, /* {{{ */
                                 const char *category, const char *type,
                                 const char *type_instance,
                                 uint64_t gauge_value) {
-  return varnish_submit(plugin_instance, category, type, type_instance, (value_t){
-      .gauge=(gauge_t)gauge_value,
-    });
+  return varnish_submit(plugin_instance, category, type, type_instance,
+                        (value_t){
+                            .gauge = (gauge_t)gauge_value,
+                        });
 } /* }}} int varnish_submit_gauge */
 
 static int varnish_submit_derive(const char *plugin_instance, /* {{{ */
                                  const char *category, const char *type,
                                  const char *type_instance,
                                  uint64_t derive_value) {
-  return varnish_submit(plugin_instance, category, type, type_instance, (value_t){
-      .derive=(derive_t)derive_value,
-    });
+  return varnish_submit(plugin_instance, category, type, type_instance,
+                        (value_t){
+                            .derive = (derive_t)derive_value,
+                        });
 } /* }}} int varnish_submit_derive */
 
 #if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
@@ -172,21 +174,21 @@ static int varnish_monitor(void *priv,
 
   if (conf->collect_connections) {
     if (strcmp(name, "client_conn") == 0)
-      return varnish_submit_derive(conf->instance, "connections",
-                                   "connections", "accepted", val);
+      return varnish_submit_derive(conf->instance, "connections", "connections",
+                                   "accepted", val);
     else if (strcmp(name, "client_drop") == 0)
-      return varnish_submit_derive(conf->instance, "connections",
-                                   "connections", "dropped", val);
+      return varnish_submit_derive(conf->instance, "connections", "connections",
+                                   "dropped", val);
     else if (strcmp(name, "client_req") == 0)
-      return varnish_submit_derive(conf->instance, "connections",
-                                   "connections", "received", val);
+      return varnish_submit_derive(conf->instance, "connections", "connections",
+                                   "received", val);
   }
 
 #ifdef HAVE_VARNISH_V3
   if (conf->collect_dirdns) {
     if (strcmp(name, "dir_dns_lookups") == 0)
-      return varnish_submit_derive(conf->instance, "dirdns",
-                                   "cache_operation", "lookups", val);
+      return varnish_submit_derive(conf->instance, "dirdns", "cache_operation",
+                                   "lookups", val);
     else if (strcmp(name, "dir_dns_failed") == 0)
       return varnish_submit_derive(conf->instance, "dirdns", "cache_result",
                                    "failed", val);
@@ -441,26 +443,26 @@ static int varnish_monitor(void *priv,
       return varnish_submit_gauge(conf->instance, "sms", "requests",
                                   "outstanding", val);
     else if (strcmp(name, "sms_nbytes") == 0)
-      return varnish_submit_gauge(conf->instance, "sms", "bytes",
-                                  "outstanding", val);
+      return varnish_submit_gauge(conf->instance, "sms", "bytes", "outstanding",
+                                  val);
     else if (strcmp(name, "sms_balloc") == 0)
       return varnish_submit_derive(conf->instance, "sms", "total_bytes",
                                    "allocated", val);
     else if (strcmp(name, "sms_bfree") == 0)
-      return varnish_submit_derive(conf->instance, "sms", "total_bytes",
-                                   "free", val);
+      return varnish_submit_derive(conf->instance, "sms", "total_bytes", "free",
+                                   val);
   }
 
   if (conf->collect_struct) {
     if (strcmp(name, "n_sess_mem") == 0)
-      return varnish_submit_gauge(conf->instance, "struct",
-                                  "current_sessions", "sess_mem", val);
+      return varnish_submit_gauge(conf->instance, "struct", "current_sessions",
+                                  "sess_mem", val);
     else if (strcmp(name, "n_sess") == 0)
-      return varnish_submit_gauge(conf->instance, "struct",
-                                  "current_sessions", "sess", val);
+      return varnish_submit_gauge(conf->instance, "struct", "current_sessions",
+                                  "sess", val);
     else if (strcmp(name, "n_object") == 0)
-      return varnish_submit_gauge(conf->instance, "struct", "objects",
-                                  "object", val);
+      return varnish_submit_gauge(conf->instance, "struct", "objects", "object",
+                                  val);
     else if (strcmp(name, "n_vampireobject") == 0)
       return varnish_submit_gauge(conf->instance, "struct", "objects",
                                   "vampireobject", val);
@@ -495,14 +497,14 @@ static int varnish_monitor(void *priv,
       return varnish_submit_derive(conf->instance, "totals", "total_requests",
                                    "requests", val);
     else if (strcmp(name, "s_pipe") == 0)
-      return varnish_submit_derive(conf->instance, "totals",
-                                   "total_operations", "pipe", val);
+      return varnish_submit_derive(conf->instance, "totals", "total_operations",
+                                   "pipe", val);
     else if (strcmp(name, "s_pass") == 0)
-      return varnish_submit_derive(conf->instance, "totals",
-                                   "total_operations", "pass", val);
+      return varnish_submit_derive(conf->instance, "totals", "total_operations",
+                                   "pass", val);
     else if (strcmp(name, "s_fetch") == 0)
-      return varnish_submit_derive(conf->instance, "totals",
-                                   "total_operations", "fetches", val);
+      return varnish_submit_derive(conf->instance, "totals", "total_operations",
+                                   "fetches", val);
     else if (strcmp(name, "s_synth") == 0)
       return varnish_submit_derive(conf->instance, "totals", "total_bytes",
                                    "synth", val);
@@ -528,8 +530,8 @@ static int varnish_monitor(void *priv,
       return varnish_submit_derive(conf->instance, "totals", "total_bytes",
                                    "pipe_out", val);
     else if (strcmp(name, "n_purges") == 0)
-      return varnish_submit_derive(conf->instance, "totals",
-                                   "total_operations", "purges", val);
+      return varnish_submit_derive(conf->instance, "totals", "total_operations",
+                                   "purges", val);
     else if (strcmp(name, "s_hdrbytes") == 0)
       return varnish_submit_derive(conf->instance, "totals", "total_bytes",
                                    "header-bytes", val);
@@ -537,11 +539,11 @@ static int varnish_monitor(void *priv,
       return varnish_submit_derive(conf->instance, "totals", "total_bytes",
                                    "body-bytes", val);
     else if (strcmp(name, "n_gzip") == 0)
-      return varnish_submit_derive(conf->instance, "totals",
-                                   "total_operations", "gzip", val);
+      return varnish_submit_derive(conf->instance, "totals", "total_operations",
+                                   "gzip", val);
     else if (strcmp(name, "n_gunzip") == 0)
-      return varnish_submit_derive(conf->instance, "totals",
-                                   "total_operations", "gunzip", val);
+      return varnish_submit_derive(conf->instance, "totals", "total_operations",
+                                   "gunzip", val);
   }
 
   if (conf->collect_uptime) {
@@ -558,8 +560,8 @@ static int varnish_monitor(void *priv,
       return varnish_submit_gauge(conf->instance, "vcl", "vcl", "avail_vcl",
                                   val);
     else if (strcmp(name, "n_vcl_discard") == 0)
-      return varnish_submit_gauge(conf->instance, "vcl", "vcl",
-                                  "discarded_vcl", val);
+      return varnish_submit_gauge(conf->instance, "vcl", "vcl", "discarded_vcl",
+                                  val);
     else if (strcmp(name, "vmods") == 0)
       return varnish_submit_gauge(conf->instance, "vcl", "objects", "vmod",
                                   val);
@@ -600,17 +602,17 @@ static int varnish_monitor(void *priv,
       return varnish_submit_derive(conf->instance, "workers", "total_threads",
                                    "dropped", val);
     else if (strcmp(name, "n_wrk_queue") == 0)
-      return varnish_submit_derive(conf->instance, "workers",
-                                   "total_requests", "queued", val);
+      return varnish_submit_derive(conf->instance, "workers", "total_requests",
+                                   "queued", val);
     else if (strcmp(name, "n_wrk_overflow") == 0)
-      return varnish_submit_derive(conf->instance, "workers",
-                                   "total_requests", "overflowed", val);
+      return varnish_submit_derive(conf->instance, "workers", "total_requests",
+                                   "overflowed", val);
     else if (strcmp(name, "n_wrk_queued") == 0)
-      return varnish_submit_derive(conf->instance, "workers",
-                                   "total_requests", "queued", val);
+      return varnish_submit_derive(conf->instance, "workers", "total_requests",
+                                   "queued", val);
     else if (strcmp(name, "n_wrk_lqueue") == 0)
-      return varnish_submit_derive(conf->instance, "workers",
-                                   "total_requests", "queue_length", val);
+      return varnish_submit_derive(conf->instance, "workers", "total_requests",
+                                   "queue_length", val);
   }
 
 #if HAVE_VARNISH_V4
@@ -1135,9 +1137,10 @@ static int varnish_init(void) /* {{{ */
       /* group = */ "varnish",
       /* name      = */ "varnish/localhost",
       /* callback  = */ varnish_read,
-      /* interval  = */ 0, &(user_data_t){
-                               .data = conf, .free_func = varnish_config_free,
-                           });
+      /* interval  = */ 0,
+      &(user_data_t){
+          .data = conf, .free_func = varnish_config_free,
+      });
 
   return 0;
 } /* }}} int varnish_init */
@@ -1296,15 +1299,16 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */
   }
 
   snprintf(callback_name, sizeof(callback_name), "varnish/%s",
-            (conf->instance == NULL) ? "localhost" : conf->instance);
+           (conf->instance == NULL) ? "localhost" : conf->instance);
 
   plugin_register_complex_read(
       /* group = */ "varnish",
       /* name      = */ callback_name,
       /* callback  = */ varnish_read,
-      /* interval  = */ 0, &(user_data_t){
-                               .data = conf, .free_func = varnish_config_free,
-                           });
+      /* interval  = */ 0,
+      &(user_data_t){
+          .data = conf, .free_func = varnish_config_free,
+      });
 
   have_instance = 1;
 
index b3e34f4ec4b9d66d30124162ae0177182678c708..ca6e831ed5ee4ff2bbd1e9fab8c13d7a7d2308e6 100644 (file)
@@ -753,7 +753,7 @@ static void disk_submit(struct lv_block_info *binfo, virDomainPtr dom,
 
   char flush_type_instance[DATA_MAX_NAME_LEN];
   snprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
-            type_instance);
+           type_instance);
 
   if ((binfo->bi.rd_req != -1) && (binfo->bi.wr_req != -1))
     submit_derive2("disk_ops", (derive_t)binfo->bi.rd_req,
@@ -829,7 +829,7 @@ static void domain_state_submit(virDomainPtr dom, int state, int reason) {
 #endif
 
   snprintf(msg, sizeof(msg), "Domain state: %s. Reason: %s", state_str,
-            reason_str);
+           reason_str);
 
   int severity;
   switch (state) {
@@ -1180,8 +1180,7 @@ static void vcpu_pin_submit(virDomainPtr dom, int max_cpus, int vcpu,
     char type_instance[DATA_MAX_NAME_LEN];
     _Bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0;
 
-    snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu,
-              cpu);
+    snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu, cpu);
     submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1);
   }
 }
@@ -1722,7 +1721,7 @@ static int lv_domain_get_tag(xmlXPathContextPtr xpath_ctx, const char *dom_name,
   }
 
   snprintf(xpath_str, sizeof(xpath_str), "/domain/metadata/%s:%s/text()",
-            METADATA_VM_PARTITION_PREFIX, METADATA_VM_PARTITION_ELEMENT);
+           METADATA_VM_PARTITION_PREFIX, METADATA_VM_PARTITION_ELEMENT);
   xpath_obj = xmlXPathEvalExpression((xmlChar *)xpath_str, xpath_ctx);
   if (xpath_obj == NULL) {
     ERROR(PLUGIN_NAME " plugin: xmlXPathEval(%s) failed on domain %s",
index cb3cc254291fa0c3ef3f69b730f623cac2efaec2..489a367d75aea0859e3e1ec64b2ea7718cbf4f64 100644 (file)
@@ -22,8 +22,8 @@
  *   Florian octo Forster <octo at collectd.org>
  **/
 
-#include "virt.c" /* sic */
 #include "testing.h"
+#include "virt.c" /* sic */
 
 #include <unistd.h>
 
index 8fbb715cae8d54c51bf7c27195d815c965edb085..a8d132060ab731843f842844f0d8ecaf5a871853 100644 (file)
@@ -546,10 +546,10 @@ static int wg_config_node(oconfig_item_t *ci) {
   /* FIXME: Legacy configuration syntax. */
   if (cb->name == NULL)
     snprintf(callback_name, sizeof(callback_name), "write_graphite/%s/%s/%s",
-              cb->node, cb->service, cb->protocol);
+             cb->node, cb->service, cb->protocol);
   else
     snprintf(callback_name, sizeof(callback_name), "write_graphite/%s",
-              cb->name);
+             cb->name);
 
   plugin_register_write(callback_name, wg_write,
                         &(user_data_t){
index 1c270bdf886c72fbe091885edb761df07ab29a16..2dd13c5b1feac51b23b03272781fea312e518b79 100644 (file)
@@ -191,7 +191,7 @@ static int wh_callback_init(wh_callback_t *cb) /* {{{ */
     }
 
     snprintf(cb->credentials, credentials_size, "%s:%s", cb->user,
-              (cb->pass == NULL) ? "" : cb->pass);
+             (cb->pass == NULL) ? "" : cb->pass);
     curl_easy_setopt(cb->curl, CURLOPT_USERPWD, cb->credentials);
 #endif
     curl_easy_setopt(cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
@@ -370,8 +370,8 @@ static int wh_write_command(const data_set_t *ds,
   }
 
   command_len = (size_t)snprintf(command, sizeof(command),
-                                  "PUTVAL %s interval=%.3f %s\r\n", key,
-                                  CDTIME_T_TO_DOUBLE(vl->interval), values);
+                                 "PUTVAL %s interval=%.3f %s\r\n", key,
+                                 CDTIME_T_TO_DOUBLE(vl->interval), values);
   if (command_len >= sizeof(command)) {
     ERROR("write_http plugin: Command buffer too small: "
           "Need %zu bytes.",
index b1c8bf94a2a716184797434e6c157ecf6fb6a2d3..3c573801c22823d992835585530d4b8afca3cb1e 100644 (file)
@@ -399,7 +399,7 @@ static void kafka_config_topic(rd_kafka_conf_t *conf,
   rd_kafka_topic_conf_set_opaque(tctx->conf, tctx);
 
   snprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
-            tctx->topic_name);
+           tctx->topic_name);
 
   status = plugin_register_write(
       callback_name, kafka_write,
index 325a6c68d76d492ec210483af3e7d650e53d7844..eac0d68efb672607f684bede0ace98630a27bf07 100644 (file)
@@ -160,7 +160,7 @@ static char *format_labels(char *buffer, size_t buffer_size,
   for (size_t i = 0; i < m->n_label; i++) {
     char value[LABEL_VALUE_SIZE];
     snprintf(labels[i], LABEL_BUFFER_SIZE, "%s=\"%s\"", m->label[i]->name,
-              escape_label_value(value, sizeof(value), m->label[i]->value));
+             escape_label_value(value, sizeof(value), m->label[i]->value));
   }
 
   strjoin(buffer, buffer_size, labels, m->n_label, ",");
@@ -182,9 +182,9 @@ static void format_text(ProtobufCBuffer *buffer) {
     buffer->append(buffer, strlen(line), (uint8_t *)line);
 
     snprintf(line, sizeof(line), "# TYPE %s %s\n", fam->name,
-              (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
-                  ? "gauge"
-                  : "counter");
+             (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
+                 ? "gauge"
+                 : "counter");
     buffer->append(buffer, strlen(line), (uint8_t *)line);
 
     for (size_t i = 0; i < fam->n_metric; i++) {
@@ -195,16 +195,16 @@ static void format_text(ProtobufCBuffer *buffer) {
       char timestamp_ms[24] = "";
       if (m->has_timestamp_ms)
         snprintf(timestamp_ms, sizeof(timestamp_ms), " %" PRIi64,
-                  m->timestamp_ms);
+                 m->timestamp_ms);
 
       if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
         snprintf(line, sizeof(line), "%s{%s} " GAUGE_FORMAT "%s\n", fam->name,
-                  format_labels(labels, sizeof(labels), m), m->gauge->value,
-                  timestamp_ms);
+                 format_labels(labels, sizeof(labels), m), m->gauge->value,
+                 timestamp_ms);
       else /* if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__COUNTER) */
         snprintf(line, sizeof(line), "%s{%s} %.0f%s\n", fam->name,
-                  format_labels(labels, sizeof(labels), m), m->counter->value,
-                  timestamp_ms);
+                 format_labels(labels, sizeof(labels), m), m->counter->value,
+                 timestamp_ms);
 
       buffer->append(buffer, strlen(line), (uint8_t *)line);
     }
@@ -213,7 +213,7 @@ static void format_text(ProtobufCBuffer *buffer) {
 
   char server[1024];
   snprintf(server, sizeof(server), "\n# collectd/write_prometheus %s at %s\n",
-            PACKAGE_VERSION, hostname_g);
+           PACKAGE_VERSION, hostname_g);
   buffer->append(buffer, strlen(server), (uint8_t *)server);
 
   pthread_mutex_unlock(&metrics_lock);
@@ -599,8 +599,8 @@ static int metric_family_update(Io__Prometheus__Client__MetricFamily *fam,
   if (m == NULL)
     return -1;
 
-  return metric_update(m, vl->values[ds_index], ds->ds[ds_index].type,
-                       vl->time, vl->interval);
+  return metric_update(m, vl->values[ds_index], ds->ds[ds_index].type, vl->time,
+                       vl->interval);
 }
 
 /* metric_family_destroy frees the memory used by a metric family. */
index 7be236ad089f3189a8ec07250fb1c1d2c9fc18a0..5a029de2761a4c75c618ea8f11cd448831c1e1ff 100644 (file)
@@ -71,8 +71,7 @@ static int wr_write(const data_set_t *ds, /* {{{ */
   if (status != 0)
     return status;
   snprintf(key, sizeof(key), "%s%s",
-            (node->prefix != NULL) ? node->prefix : REDIS_DEFAULT_PREFIX,
-            ident);
+           (node->prefix != NULL) ? node->prefix : REDIS_DEFAULT_PREFIX, ident);
   snprintf(time, sizeof(time), "%.9f", CDTIME_T_TO_DOUBLE(vl->time));
 
   value_size = sizeof(value);
@@ -221,10 +220,11 @@ static int wr_config_node(oconfig_item_t *ci) /* {{{ */
 
     snprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
 
-    status = plugin_register_write(
-        cb_name, wr_write, &(user_data_t){
-                               .data = node, .free_func = wr_config_free,
-                           });
+    status =
+        plugin_register_write(cb_name, wr_write,
+                              &(user_data_t){
+                                  .data = node, .free_func = wr_config_free,
+                              });
   }
 
   if (status != 0)
index 488b482171bb5150fa60a299feee4019e45d7d3e..6db3ef58ac88349adfd274cb1d1015e7cf9f4089 100644 (file)
@@ -293,18 +293,17 @@ wrr_value_to_event(struct riemann_host const *host, /* {{{ */
               vl->type_instance);
   if (host->always_append_ds || (ds->ds_num > 1)) {
     if (host->event_service_prefix == NULL)
-      snprintf(service_buffer, sizeof(service_buffer), "%s/%s",
-                &name_buffer[1], ds->ds[index].name);
+      snprintf(service_buffer, sizeof(service_buffer), "%s/%s", &name_buffer[1],
+               ds->ds[index].name);
     else
       snprintf(service_buffer, sizeof(service_buffer), "%s%s/%s",
-                host->event_service_prefix, &name_buffer[1],
-                ds->ds[index].name);
+               host->event_service_prefix, &name_buffer[1], ds->ds[index].name);
   } else {
     if (host->event_service_prefix == NULL)
       sstrncpy(service_buffer, &name_buffer[1], sizeof(service_buffer));
     else
       snprintf(service_buffer, sizeof(service_buffer), "%s%s",
-                host->event_service_prefix, &name_buffer[1]);
+               host->event_service_prefix, &name_buffer[1]);
   }
 
   riemann_event_set(
@@ -353,7 +352,7 @@ wrr_value_to_event(struct riemann_host const *host, /* {{{ */
     char ds_type[DATA_MAX_NAME_LEN];
 
     snprintf(ds_type, sizeof(ds_type), "%s:rate",
-              DS_TYPE_TO_STRING(ds->ds[index].type));
+             DS_TYPE_TO_STRING(ds->ds[index].type));
     riemann_event_string_attribute_add(event, "ds_type", ds_type);
   } else {
     riemann_event_string_attribute_add(event, "ds_type",
@@ -803,7 +802,7 @@ static int wrr_config_node(oconfig_item_t *ci) /* {{{ */
   }
 
   snprintf(callback_name, sizeof(callback_name), "write_riemann/%s",
-            host->name);
+           host->name);
 
   user_data_t ud = {.data = host, .free_func = wrr_free};
 
index 51f962202df42e3e8db0aeebdacee064911124bb..ce23e654204a22f3fa4cc5e3f8aee4385976ae44 100644 (file)
@@ -421,7 +421,7 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
   if ((ds->ds[index].type != DS_TYPE_GAUGE) && (rates != NULL)) {
     char ds_type[DATA_MAX_NAME_LEN];
     snprintf(ds_type, sizeof(ds_type), "%s:rate",
-              DS_TYPE_TO_STRING(ds->ds[index].type));
+             DS_TYPE_TO_STRING(ds->ds[index].type));
     res = my_asprintf(&temp_str, "%s, \"collectd_data_source_type\": \"%s\"",
                       ret_str, ds_type);
     free(ret_str);
@@ -535,16 +535,16 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
   if (host->always_append_ds || (ds->ds_num > 1)) {
     if (host->event_service_prefix == NULL)
       snprintf(service_buffer, sizeof(service_buffer), "%s.%s", name_buffer,
-                ds->ds[index].name);
+               ds->ds[index].name);
     else
       snprintf(service_buffer, sizeof(service_buffer), "%s%s.%s",
-                host->event_service_prefix, name_buffer, ds->ds[index].name);
+               host->event_service_prefix, name_buffer, ds->ds[index].name);
   } else {
     if (host->event_service_prefix == NULL)
       sstrncpy(service_buffer, name_buffer, sizeof(service_buffer));
     else
       snprintf(service_buffer, sizeof(service_buffer), "%s%s",
-                host->event_service_prefix, name_buffer);
+               host->event_service_prefix, name_buffer);
   }
 
   // Replace collectd sensor name reserved characters so that time series DB is
index 0e469925b323163eaf60ee598af1ceda745e0142..10f636c5aad5afa936eb862d3c2c0feb7322ebaa 100644 (file)
@@ -325,7 +325,7 @@ static int wt_format_values(char *ret, size_t ret_len, int ds_num,
 
 #define BUFFER_ADD(...)                                                        \
   do {                                                                         \
-    status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__);           \
+    status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__);            \
     if (status < 1) {                                                          \
       sfree(rates);                                                            \
       return -1;                                                               \
@@ -389,18 +389,18 @@ static int wt_format_name(char *ret, int ret_len, const value_list_t *vl,
     if (vl->plugin_instance[0] == '\0') {
       if (vl->type_instance[0] == '\0') {
         snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin, vl->type,
-                  ds_name);
+                 ds_name);
       } else {
         snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin, vl->type,
-                  vl->type_instance, ds_name);
+                 vl->type_instance, ds_name);
       }
     } else { /* vl->plugin_instance != "" */
       if (vl->type_instance[0] == '\0') {
         snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin,
-                  vl->plugin_instance, vl->type, ds_name);
+                 vl->plugin_instance, vl->type, ds_name);
       } else {
         snprintf(ret, ret_len, "%s%s.%s.%s.%s.%s", prefix, vl->plugin,
-                  vl->plugin_instance, vl->type, vl->type_instance, ds_name);
+                 vl->plugin_instance, vl->type, vl->type_instance, ds_name);
       }
     }
   } else { /* ds_name == NULL */
@@ -409,15 +409,15 @@ static int wt_format_name(char *ret, int ret_len, const value_list_t *vl,
         snprintf(ret, ret_len, "%s%s.%s", prefix, vl->plugin, vl->type);
       } else {
         snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin,
-                  vl->type_instance, vl->type);
+                 vl->type_instance, vl->type);
       }
     } else { /* vl->plugin_instance != "" */
       if (vl->type_instance[0] == '\0') {
         snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin,
-                  vl->plugin_instance, vl->type);
+                 vl->plugin_instance, vl->type);
       } else {
         snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin,
-                  vl->plugin_instance, vl->type, vl->type_instance);
+                 vl->plugin_instance, vl->type, vl->type_instance);
       }
     }
   }
@@ -457,7 +457,7 @@ static int wt_send_message(const char *key, const char *value, cdtime_t time,
 
   status =
       snprintf(message, sizeof(message), "put %s %.0f %s fqdn=%s %s %s\r\n",
-                key, CDTIME_T_TO_DOUBLE(time), value, host, tags, host_tags);
+               key, CDTIME_T_TO_DOUBLE(time), value, host, tags, host_tags);
   sfree(temp);
   if (status < 0)
     return -1;
@@ -608,8 +608,8 @@ static int wt_config_tsd(oconfig_item_t *ci) {
   }
 
   snprintf(callback_name, sizeof(callback_name), "write_tsdb/%s/%s",
-            cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
-            cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
+           cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
+           cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
 
   user_data_t user_data = {.data = cb, .free_func = wt_callback_free};
 
index 86af7d498b22e2603d7380e91e3b5fcd878fdb11..730d30483b5eff16961e7167b58fa3a3e62f7864 100644 (file)
@@ -216,12 +216,14 @@ static int za_read(void) {
   // See kstat_seq_show_headers module/spl/spl-kstat.c of the spl kernel
   // module.
   if (fgets(buffer, sizeof(buffer), fh) == NULL) {
-    ERROR("zfs_arc plugin: \"%s\" does not contain a single line.", ZOL_ARCSTATS_FILE);
+    ERROR("zfs_arc plugin: \"%s\" does not contain a single line.",
+          ZOL_ARCSTATS_FILE);
     fclose(fh);
     return -1;
   }
   if (fgets(buffer, sizeof(buffer), fh) == NULL) {
-    ERROR("zfs_arc plugin: \"%s\" does not contain at least two lines.", ZOL_ARCSTATS_FILE);
+    ERROR("zfs_arc plugin: \"%s\" does not contain at least two lines.",
+          ZOL_ARCSTATS_FILE);
     fclose(fh);
     return -1;
   }