Add type-checked versions of allocation and deallocations functions
[lttng-tools.git] / src / common / channel.cpp
index ac2f915d8ec4208b41145edc53c91471ad774193..5bef795589d75c4349cdf05fe31b65a77369698f 100644 (file)
@@ -5,18 +5,16 @@
  *
  */
 
-#include <common/macros.h>
+#include <common/buffer-view.hpp>
+#include <common/dynamic-array.hpp>
+#include <common/dynamic-buffer.hpp>
+#include <common/error.hpp>
+#include <common/macros.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <lttng/channel-internal.hpp>
 #include <lttng/channel.h>
 #include <lttng/constant.h>
-#include <lttng/channel-internal.h>
-#include <lttng/userspace-probe-internal.h>
-#include <common/dynamic-buffer.h>
-#include <common/error.h>
-#include <assert.h>
-#include <string.h>
-#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/dynamic-array.h>
-#include <common/buffer-view.h>
+#include <lttng/userspace-probe-internal.hpp>
 
 static enum lttng_error_code flatten_lttng_channels(
                struct lttng_dynamic_pointer_array *channels,
@@ -39,7 +37,7 @@ struct lttng_channel *lttng_channel_copy(const struct lttng_channel *src)
        struct lttng_channel_extended *extended = nullptr;
        struct lttng_channel *channel = nullptr, *ret = nullptr;
 
-       channel = (struct lttng_channel *) zmalloc(sizeof(*channel));
+       channel = zmalloc<lttng_channel>();
        if (!channel) {
                goto end;
        }
@@ -47,8 +45,7 @@ struct lttng_channel *lttng_channel_copy(const struct lttng_channel *src)
        *channel = *src;
 
        if (src->attr.extended.ptr) {
-               extended = (struct lttng_channel_extended *) zmalloc(
-                               sizeof(*extended));
+               extended = zmalloc<lttng_channel_extended>();
                if (!extended) {
                        goto end;
                }
@@ -73,15 +70,13 @@ struct lttng_channel *lttng_channel_create_internal(void)
        struct lttng_channel *local_channel = nullptr, *ret = nullptr;
        struct lttng_channel_extended *extended = nullptr;
 
-       local_channel = (struct lttng_channel *) zmalloc(
-                       sizeof(struct lttng_channel));
+       local_channel = zmalloc<lttng_channel>();
        if (!local_channel) {
                goto end;
        }
 
        /* Extended struct */
-       extended = (struct lttng_channel_extended *) zmalloc(
-                       sizeof(*extended));
+       extended = zmalloc<lttng_channel_extended>();
        if (!extended) {
                goto end;
        }
This page took 0.024589 seconds and 4 git commands to generate.