python: Addressed review comments
[collectd.git] / src / swap.c
index f64a9b3..19eed46 100644 (file)
@@ -190,12 +190,10 @@ static int swap_init(void) /* {{{ */
 static void swap_submit_usage(char const *plugin_instance, /* {{{ */
                               gauge_t used, gauge_t free,
                               char const *other_name, gauge_t other_value) {
-  value_t v[1];
   value_list_t vl = VALUE_LIST_INIT;
 
-  vl.values = v;
-  vl.values_len = STATIC_ARRAY_SIZE(v);
-  sstrncpy(vl.host, hostname_g, sizeof(vl.host));
+  vl.values = &(value_t){.gauge = NAN};
+  vl.values_len = 1;
   sstrncpy(vl.plugin, "swap", sizeof(vl.plugin));
   if (plugin_instance != NULL)
     sstrncpy(vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance));
@@ -214,13 +212,9 @@ __attribute__((nonnull(1))) static void
 swap_submit_derive(char const *type_instance, /* {{{ */
                    derive_t value) {
   value_list_t vl = VALUE_LIST_INIT;
-  value_t v[1];
 
-  v[0].derive = value;
-
-  vl.values = v;
-  vl.values_len = STATIC_ARRAY_SIZE(v);
-  sstrncpy(vl.host, hostname_g, sizeof(vl.host));
+  vl.values = &(value_t){.derive = value};
+  vl.values_len = 1;
   sstrncpy(vl.plugin, "swap", sizeof(vl.plugin));
   sstrncpy(vl.type, "swap_io", sizeof(vl.type));
   sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
@@ -744,5 +738,3 @@ void module_register(void) {
   plugin_register_init("swap", swap_init);
   plugin_register_read("swap", swap_read);
 } /* void module_register */
-
-/* vim: set fdm=marker : */