From 60b9a6ea2ffec1e9a2f0a042212224f8937611ac Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 14 Jan 2014 08:34:42 +0100 Subject: [PATCH] swap plugin: Remove the swap_submit() function. This function was used only by swap_submit_derive(), which was declared conditionally. This resulted in "defined but not used" warnings, e.g. on FreeBSD. --- src/swap.c | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/src/swap.c b/src/swap.c index 91f6a19f..508f9d54 100644 --- a/src/swap.c +++ b/src/swap.c @@ -188,27 +188,6 @@ static int swap_init (void) /* {{{ */ return (0); } /* }}} int swap_init */ -static void swap_submit (const char *plugin_instance, /* {{{ */ - const char *type, const char *type_instance, - value_t value) -{ - value_list_t vl = VALUE_LIST_INIT; - - assert (type != NULL); - - vl.values = &value; - vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); - sstrncpy (vl.plugin, "swap", sizeof (vl.plugin)); - if (plugin_instance != NULL) - sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); - sstrncpy (vl.type, type, sizeof (vl.type)); - if (type_instance != NULL) - sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); - - plugin_dispatch_values (&vl); -} /* }}} void swap_submit_inst */ - static void swap_submit_usage (char const *plugin_instance, /* {{{ */ gauge_t used, gauge_t free, char const *other_name, gauge_t other_value) @@ -236,13 +215,23 @@ static void swap_submit_usage (char const *plugin_instance, /* {{{ */ } /* }}} void swap_submit_usage */ #if KERNEL_LINUX || HAVE_PERFSTAT -static void swap_submit_derive (const char *plugin_instance, /* {{{ */ - const char *type_instance, derive_t value) +__attribute__((nonnull(1))) +static void swap_submit_derive (char const *type_instance, /* {{{ */ + derive_t value) { - value_t v; + value_list_t vl = VALUE_LIST_INIT; + value_t v[1]; + + v[0].derive = value; - v.derive = value; - swap_submit (plugin_instance, "swap_io", type_instance, v); + vl.values = v; + vl.values_len = STATIC_ARRAY_SIZE (v); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + 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)); + + plugin_dispatch_values (&vl); } /* }}} void swap_submit_derive */ #endif @@ -437,8 +426,8 @@ static int swap_read_io (void) /* {{{ */ swap_out = swap_out * pagesize; } - swap_submit_derive (NULL, "in", swap_in); - swap_submit_derive (NULL, "out", swap_out); + swap_submit_derive ("in", swap_in); + swap_submit_derive ("out", swap_out); return (0); } /* }}} int swap_read_io */ @@ -795,8 +784,8 @@ static int swap_read (void) /* {{{ */ reserved = (gauge_t) (pmemory.pgsp_rsvd * pagesize); swap_submit_usage (NULL, total - free, free, "reserved", reserved); - swap_submit_derive (NULL, "in", (derive_t) pmemory.pgspins * pagesize); - swap_submit_derive (NULL, "out", (derive_t) pmemory.pgspouts * pagesize); + swap_submit_derive ("in", (derive_t) pmemory.pgspins * pagesize); + swap_submit_derive ("out", (derive_t) pmemory.pgspouts * pagesize); return (0); } /* }}} int swap_read */ -- 2.11.0