From: Jérémie Galarneau Date: Mon, 22 Jul 2024 19:09:53 +0000 (+0000) Subject: sessiond: agent_event: use lttng::utils::container_of X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=0bd2d108d185c94ea694f423e9901b2ceba12836;p=lttng-tools.git sessiond: agent_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: I28f5b7db71ce0c7a7d0ff367d88a8350bd66d988 Signed-off-by: Jérémie Galarneau --- 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. */