Merge pull request #2618 from ajssmith/amqp1_dev1_branch
[collectd.git] / src / intel_pmu.c
index 57ae974..c9bbb50 100644 (file)
@@ -67,9 +67,9 @@ struct event_info {
 typedef struct event_info event_info_t;
 
 struct intel_pmu_ctx_s {
-  _Bool hw_cache_events;
-  _Bool kernel_pmu_events;
-  _Bool sw_events;
+  bool hw_cache_events;
+  bool kernel_pmu_events;
+  bool sw_events;
   char event_list_fn[PATH_MAX];
   char **hw_events;
   size_t hw_events_count;
@@ -196,7 +196,8 @@ static void pmu_dump_config(void) {
   DEBUG(PMU_PLUGIN ":   software_events   : %d", g_ctx.sw_events);
 
   for (size_t i = 0; i < g_ctx.hw_events_count; i++) {
-    DEBUG(PMU_PLUGIN ":   hardware_events[%zu]: %s", i, g_ctx.hw_events[i]);
+    DEBUG(PMU_PLUGIN ":   hardware_events[%" PRIsz "]: %s", i,
+          g_ctx.hw_events[i]);
   }
 }
 
@@ -213,8 +214,12 @@ static void pmu_dump_cgroups(void) {
       return;
     }
     for (size_t j = 0; j < cgroup->num_cores; j++)
-      snprintf(cores + strlen(cores), cores_size - strlen(cores), " %d",
-               cgroup->cores[j]);
+      if (snprintf(cores + strlen(cores), cores_size - strlen(cores), " %d",
+                   cgroup->cores[j]) < 0) {
+        DEBUG(PMU_PLUGIN ": Failed to write list of cores to string.");
+        sfree(cores);
+        return;
+      }
 
     DEBUG(PMU_PLUGIN ":   group[%" PRIsz "]", i);
     DEBUG(PMU_PLUGIN ":     description: %s", cgroup->desc);
@@ -325,8 +330,8 @@ static int pmu_config(oconfig_item_t *ci) {
   return 0;
 }
 
-static void pmu_submit_counter(char *cgroup, char *event, counter_t value,
-                               meta_data_t *meta) {
+static void pmu_submit_counter(const char *cgroup, const char *event,
+                               counter_t value, meta_data_t *meta) {
   value_list_t vl = VALUE_LIST_INIT;
 
   vl.values = &(value_t){.counter = value};