common: replace container_of with a C++ safe implementation
[lttng-tools.git] / src / common / consumer / consumer-stream.cpp
index f57e37ab81379027daf318acc58d2b90b710b41d..33f97c77e66a2e074718ad8ce81b8073c3abe7e8 100644 (file)
@@ -35,9 +35,9 @@
 static void free_stream_rcu(struct rcu_head *head)
 {
        struct lttng_ht_node_u64 *node =
-               caa_container_of(head, struct lttng_ht_node_u64, head);
+               lttng::utils::container_of(head, &lttng_ht_node_u64::head);
        struct lttng_consumer_stream *stream =
-               caa_container_of(node, struct lttng_consumer_stream, node);
+               lttng::utils::container_of(node, &lttng_consumer_stream::node);
 
        pthread_mutex_destroy(&stream->lock);
        free(stream);
@@ -654,7 +654,7 @@ struct lttng_consumer_stream *consumer_stream_create(
        int ret;
        struct lttng_consumer_stream *stream;
 
-       stream = (lttng_consumer_stream *) zmalloc(sizeof(*stream));
+       stream = zmalloc<lttng_consumer_stream>();
        if (stream == NULL) {
                PERROR("malloc struct lttng_consumer_stream");
                ret = -ENOMEM;
This page took 0.023167 seconds and 4 git commands to generate.