**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
static void serial_submit (const char *type_instance,
derive_t rx, derive_t tx)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = rx;
- values[1].derive = tx;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "serial", sizeof (vl.plugin));
sstrncpy (vl.type, "serial_octets", sizeof (vl.type));
char *fields[16];
int numfields;
- int i;
numfields = strsplit (buffer, fields, STATIC_ARRAY_SIZE (fields));
if (numfields < 6)
continue;
fields[0][len - 1] = 0;
- for (i = 1; i < numfields; i++)
+ for (int i = 1; i < numfields; i++)
{
len = strlen (fields[i]);
if (len < 4)