common: replace container_of with a C++ safe implementation
[lttng-tools.git] / src / common / actions / snapshot-session.cpp
index c3570081abcdf2248137fdd8c631403a3c45c0bf..6af260c93e35a3e7cb2659429cd0a6f0f849bf53 100644 (file)
@@ -23,6 +23,7 @@
 #define IS_SNAPSHOT_SESSION_ACTION(action) \
        (lttng_action_get_type(action) == LTTNG_ACTION_TYPE_SNAPSHOT_SESSION)
 
+namespace {
 struct lttng_action_snapshot_session {
        struct lttng_action parent;
 
@@ -54,6 +55,7 @@ struct lttng_action_snapshot_session_comm {
         */
        char data[];
 } LTTNG_PACKED;
+} /* namespace */
 
 static const struct lttng_rate_policy *
 lttng_action_snapshot_session_internal_get_rate_policy(
@@ -64,8 +66,8 @@ action_snapshot_session_from_action(struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
-       return container_of(
-                       action, struct lttng_action_snapshot_session, parent);
+       return lttng::utils::container_of(
+                       action, &lttng_action_snapshot_session::parent);
 }
 
 static const struct lttng_action_snapshot_session *
@@ -73,8 +75,8 @@ action_snapshot_session_from_action_const(const struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
-       return container_of(
-                       action, struct lttng_action_snapshot_session, parent);
+       return lttng::utils::container_of(
+                       action, &lttng_action_snapshot_session::parent);
 }
 
 static bool lttng_action_snapshot_session_validate(struct lttng_action *action)
This page took 0.023094 seconds and 4 git commands to generate.