Fix clang-tidy cppcoreguidelines-pro-type-const-cast warning
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.cpp
index 79cb6fed89398e00833f2ea27620090eba09e81e..c9924b326190dd4e765ff81af7175bf00a0b1410 100644 (file)
@@ -484,14 +484,22 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
                        tmp_event->exclusion = 1;
                }
 
+               std::vector<const char *> exclusion_names;
+               if (uevent->exclusion) {
+                       for (int i = 0; i < uevent->exclusion->count; i++) {
+                               exclusion_names.emplace_back(
+                                       LTTNG_EVENT_EXCLUSION_NAME_AT(uevent->exclusion, i));
+                       }
+               }
+
                /*
                 * We do not care about the filter bytecode and the fd from the
                 * userspace_probe_location.
                 */
                ret = lttng_event_serialize(tmp_event,
-                                           uevent->exclusion ? uevent->exclusion->count : 0,
-                                           uevent->exclusion ? (char **) uevent->exclusion->names :
-                                                               nullptr,
+                                           exclusion_names.size(),
+                                           exclusion_names.size() ? exclusion_names.data() :
+                                                                    nullptr,
                                            uevent->filter_expression,
                                            0,
                                            nullptr,
This page took 0.027128 seconds and 4 git commands to generate.