clang-tidy reports:
cppcoreguidelines-pro-type-const-cast; do not use const_cast
The const_cast adds a const qualifier so this warning seems a bit
strict. Regardless, we can dodge the whole question by passing the
exclusion_list as `const char * const *`, which is closer to the
original intention of the API anyhow.
For more information on the safety of these types of casts, see:
https://isocpp.org/wiki/faq/const-correctness#constptrptr-conversion
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia3129b7d1ed4e450f3f2d63920d2fd67c66a6d73
int lttng_event_serialize(const struct lttng_event *event,
unsigned int exclusion_count,
int lttng_event_serialize(const struct lttng_event *event,
unsigned int exclusion_count,
- const char **exclusion_list,
+ const char *const *exclusion_list,
const char *filter_expression,
size_t bytecode_len,
struct lttng_bytecode *bytecode,
const char *filter_expression,
size_t bytecode_len,
struct lttng_bytecode *bytecode,
* We do not care about the filter bytecode and the fd from the
* userspace_probe_location.
*/
* We do not care about the filter bytecode and the fd from the
* userspace_probe_location.
*/
- ret = lttng_event_serialize(
- tmp_event,
- exclusion_names.size(),
- exclusion_names.size() ?
- exclusion_names.data() :
- nullptr,
- uevent->filter_expression,
- 0,
- nullptr,
- reply_payload);
+ ret = lttng_event_serialize(tmp_event,
+ exclusion_names.size(),
+ exclusion_names.size() ? exclusion_names.data() :
+ nullptr,
+ uevent->filter_expression,
+ 0,
+ nullptr,
+ reply_payload);
lttng_event_destroy(tmp_event);
if (ret) {
ret_code = LTTNG_ERR_FATAL;
lttng_event_destroy(tmp_event);
if (ret) {
ret_code = LTTNG_ERR_FATAL;
int lttng_event_serialize(const struct lttng_event *event,
unsigned int exclusion_count,
int lttng_event_serialize(const struct lttng_event *event,
unsigned int exclusion_count,
- const char **exclusion_list,
+ const char *const *exclusion_list,
const char *filter_expression,
size_t bytecode_len,
struct lttng_bytecode *bytecode,
const char *filter_expression,
size_t bytecode_len,
struct lttng_bytecode *bytecode,
serialize:
ret = lttng_event_serialize(ev,
exclusion_count,
serialize:
ret = lttng_event_serialize(ev,
exclusion_count,
- const_cast<const char **>(exclusion_list),
filter_expression,
bytecode_len,
(ctx && bytecode_len) ? &ctx->bytecode->b : nullptr,
filter_expression,
bytecode_len,
(ctx && bytecode_len) ? &ctx->bytecode->b : nullptr,