From: Ruben Kerkhof Date: Sun, 3 Jun 2018 22:21:52 +0000 (+0200) Subject: intel_rdt plugin: const correctness X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=74d0a5a74960beccbd4bec228fd80a6960a57d50;p=collectd.git intel_rdt plugin: const correctness CC src/intel_rdt_la-intel_rdt.lo src/intel_rdt.c: In function ‘rdt_read’: src/intel_rdt.c:407:39: warning: passing argument 2 of ‘rdt_submit_derive’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] rdt_submit_derive(cgroup->desc, "memory_bandwidth", "local", ^~~~~~~~~~~~~~~~~~ src/intel_rdt.c:339:51: note: expected ‘char *’ but argument is of type ‘const char *’ static void rdt_submit_derive(char *cgroup, char *type, char *type_instance, ~~~~~~^~~~ src/intel_rdt.c:407:59: warning: passing argument 3 of ‘rdt_submit_derive’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] rdt_submit_derive(cgroup->desc, "memory_bandwidth", "local", ^~~~~~~ src/intel_rdt.c:339:63: note: expected ‘char *’ but argument is of type ‘const char *’ static void rdt_submit_derive(char *cgroup, char *type, char *type_instance, ~~~~~~^~~~~~~~~~~~~ src/intel_rdt.c:409:39: warning: passing argument 2 of ‘rdt_submit_derive’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] rdt_submit_derive(cgroup->desc, "memory_bandwidth", "remote", ^~~~~~~~~~~~~~~~~~ src/intel_rdt.c:339:51: note: expected ‘char *’ but argument is of type ‘const char *’ static void rdt_submit_derive(char *cgroup, char *type, char *type_instance, ~~~~~~^~~~ src/intel_rdt.c:409:59: warning: passing argument 3 of ‘rdt_submit_derive’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] rdt_submit_derive(cgroup->desc, "memory_bandwidth", "remote", ^~~~~~~~ src/intel_rdt.c:339:63: note: expected ‘char *’ but argument is of type ‘const char *’ static void rdt_submit_derive(char *cgroup, char *type, char *type_instance, ~~~~~~^~~~~~~~~~~~~ --- diff --git a/src/intel_rdt.c b/src/intel_rdt.c index 667033c0..62ce9b80 100644 --- a/src/intel_rdt.c +++ b/src/intel_rdt.c @@ -25,9 +25,9 @@ * Serhiy Pshyk **/ +#include "collectd.h" #include "common.h" #include "utils_config_cores.h" -#include "collectd.h" #include @@ -336,8 +336,8 @@ static int rdt_config(oconfig_item_t *ci) { return 0; } -static void rdt_submit_derive(char *cgroup, char *type, char *type_instance, - derive_t value) { +static void rdt_submit_derive(const char *cgroup, const char *type, + const char *type_instance, derive_t value) { value_list_t vl = VALUE_LIST_INIT; vl.values = &(value_t){.derive = value}; @@ -352,8 +352,8 @@ static void rdt_submit_derive(char *cgroup, char *type, char *type_instance, plugin_dispatch_values(&vl); } -static void rdt_submit_gauge(char *cgroup, char *type, char *type_instance, - gauge_t value) { +static void rdt_submit_gauge(const char *cgroup, const char *type, + const char *type_instance, gauge_t value) { value_list_t vl = VALUE_LIST_INIT; vl.values = &(value_t){.gauge = value};