From a61068f6b170b407ce9e4d129c7845dcad6ff415 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 22 Jul 2024 19:15:32 +0000 Subject: [PATCH] sessiond: ltt_ust_event: use lttng::utils::container_of MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/bin/lttng-sessiond/trace-ust.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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. */ -- 2.34.1