From: Jérémie Galarneau Date: Mon, 22 Jul 2024 19:15:32 +0000 (+0000) Subject: sessiond: ltt_ust_event: use lttng::utils::container_of X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=a61068f6b170b407ce9e4d129c7845dcad6ff415;p=lttng-tools.git sessiond: ltt_ust_event: use lttng::utils::container_of caa_container_of makes use of offsetof which is conditionally supported for non-POD types. Replace its use by lttng::utils::container_of. Change-Id: I043c6a01ea4f96624d21bb034e545503995a2794 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/trace-ust.cpp b/src/bin/lttng-sessiond/trace-ust.cpp index ea892a6d9..4d15bd758 100644 --- a/src/bin/lttng-sessiond/trace-ust.cpp +++ b/src/bin/lttng-sessiond/trace-ust.cpp @@ -34,14 +34,11 @@ namespace lsu = lttng::sessiond::ust; */ int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node, const void *_key) { - struct ltt_ust_event *event; - const char *name; - LTTNG_ASSERT(node); LTTNG_ASSERT(_key); - event = caa_container_of(node, struct ltt_ust_event, node.node); - name = (const char *) _key; + auto *event = lttng_ht_node_container_of(node, <t_ust_event::node); + const auto *name = (const char *) _key; /* Event name */ if (strncmp(event->attr.name, name, sizeof(event->attr.name)) != 0) { @@ -63,16 +60,14 @@ no_match: */ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key) { - struct ltt_ust_event *event; - const struct ltt_ust_ht_key *key; int ev_loglevel_value; - int ll_match; + bool ll_match; LTTNG_ASSERT(node); LTTNG_ASSERT(_key); - event = caa_container_of(node, struct ltt_ust_event, node.node); - key = (ltt_ust_ht_key *) _key; + auto *event = lttng_ht_node_container_of(node, <t_ust_event::node); + const auto *key = (ltt_ust_ht_key *) _key; ev_loglevel_value = event->attr.loglevel; /* Match the 4 elements of the key: name, filter, loglevel, exclusions. */