From 0bd2d108d185c94ea694f423e9901b2ceba12836 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 22 Jul 2024 19:09:53 +0000 Subject: [PATCH] sessiond: agent_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: I28f5b7db71ce0c7a7d0ff367d88a8350bd66d988 Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/agent.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/bin/lttng-sessiond/agent.cpp b/src/bin/lttng-sessiond/agent.cpp index 48968c44b..2505a410c 100644 --- a/src/bin/lttng-sessiond/agent.cpp +++ b/src/bin/lttng-sessiond/agent.cpp @@ -94,14 +94,11 @@ static void log_reply_code(uint32_t in_reply_ret_code) */ static int ht_match_event_by_name(struct cds_lfht_node *node, const void *_key) { - struct agent_event *event; - const struct agent_ht_key *key; - LTTNG_ASSERT(node); LTTNG_ASSERT(_key); - event = caa_container_of(node, struct agent_event, node.node); - key = (agent_ht_key *) _key; + auto *event = lttng_ht_node_container_of(node, &agent_event::node); + const auto *key = static_cast(_key); /* Match 1 elements of the key: name. */ @@ -122,15 +119,12 @@ no_match: */ static int ht_match_event(struct cds_lfht_node *node, const void *_key) { - struct agent_event *event; - const struct agent_ht_key *key; - int ll_match; - LTTNG_ASSERT(node); LTTNG_ASSERT(_key); - event = caa_container_of(node, struct agent_event, node.node); - key = (agent_ht_key *) _key; + const auto *event = lttng_ht_node_container_of(node, &agent_event::node); + const auto *key = (agent_ht_key *) _key; + bool ll_match; /* Match 2 elements of the key: name and loglevel. */ -- 2.34.1