sessiond: agent_event: use lttng::utils::container_of
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Jul 2024 19:09:53 +0000 (19:09 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Jul 2024 01:26:51 +0000 (01:26 +0000)
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 <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/agent.cpp

index 48968c44bc47ac1b7cbae23ac41a6239dbcf1baa..2505a410c49f837b81cb060fb4d87b29162927a9 100644 (file)
@@ -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<const agent_ht_key *>(_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. */
 
This page took 0.025848 seconds and 4 git commands to generate.