sessiond: ltt_ust_event: use lttng::utils::container_of
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Jul 2024 19:15:32 +0000 (19:15 +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: I043c6a01ea4f96624d21bb034e545503995a2794
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/trace-ust.cpp

index ea892a6d92c69cd40dc92d4c032967a7ca2f53ef..4d15bd7589f673a8dfc9b10b24f155b41a0e18fb 100644 (file)
@@ -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, &ltt_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, &ltt_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. */
This page took 0.026709 seconds and 4 git commands to generate.