Merge branch 'collectd-5.6'
[collectd.git] / src / vserver.c
index 806fd92..0e58a97 100644 (file)
@@ -56,15 +56,14 @@ static int vserver_init (void)
 static void traffic_submit (const char *plugin_instance,
                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 = STATIC_ARRAY_SIZE (values);
-       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
        sstrncpy (vl.type, "if_octets", sizeof (vl.type));
@@ -76,16 +75,15 @@ static void traffic_submit (const char *plugin_instance,
 static void load_submit (const char *plugin_instance,
                gauge_t snum, gauge_t mnum, gauge_t lnum)
 {
-       value_t values[3];
        value_list_t vl = VALUE_LIST_INIT;
-
-       values[0].gauge = snum;
-       values[1].gauge = mnum;
-       values[2].gauge = lnum;
+       value_t values[] = {
+               { .gauge = snum },
+               { .gauge = mnum },
+               { .gauge = lnum },
+       };
 
        vl.values = values;
        vl.values_len = STATIC_ARRAY_SIZE (values);
-       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
        sstrncpy (vl.type, "load", sizeof (vl.type));
@@ -97,14 +95,10 @@ static void submit_gauge (const char *plugin_instance, const char *type,
                const char *type_instance, gauge_t value)
 
 {
-       value_t values[1];
        value_list_t vl = VALUE_LIST_INIT;
 
-       values[0].gauge = value;
-
-       vl.values = values;
-       vl.values_len = STATIC_ARRAY_SIZE (values);
-       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       vl.values = &(value_t) { .gauge = value };
+       vl.values_len = 1;
        sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
        sstrncpy (vl.type, type, sizeof (vl.type));