Add type-checked versions of allocation and deallocations functions
[lttng-tools.git] / src / common / tracker.cpp
index c5efaa3198b6aa5cfaea5c038e491ccfee92cc89..181a0a8c9c69e411136c7e78979aba5af1d4a013 100644 (file)
 #include <lttng/lttng-error.h>
 #include <lttng/tracker.h>
 
-#include <common/dynamic-array.h>
-#include <common/error.h>
-#include <common/hashtable/hashtable.h>
-#include <common/hashtable/utils.h>
-#include <common/tracker.h>
+#include <common/dynamic-array.hpp>
+#include <common/error.hpp>
+#include <common/hashtable/hashtable.hpp>
+#include <common/hashtable/utils.hpp>
+#include <common/tracker.hpp>
 
 #include <stdbool.h>
 
@@ -71,7 +71,7 @@ enum lttng_error_code process_attr_value_from_comm(
 {
        char *name = NULL;
        enum lttng_error_code ret = LTTNG_OK;
-       struct process_attr_value *value = (process_attr_value *) zmalloc(sizeof(*value));
+       struct process_attr_value *value = zmalloc<process_attr_value>();
 
        if (!value) {
                ret = LTTNG_ERR_NOMEM;
@@ -214,7 +214,7 @@ static void process_attr_tracker_value_destructor(void *ptr)
 
 struct lttng_process_attr_values *lttng_process_attr_values_create(void)
 {
-       struct lttng_process_attr_values *values = (lttng_process_attr_values *) zmalloc(sizeof(*values));
+       struct lttng_process_attr_values *values = zmalloc<lttng_process_attr_values>();
 
        if (!values) {
                goto end;
@@ -247,6 +247,7 @@ int process_attr_tracker_value_serialize(const struct process_attr_value *value,
        int ret;
        struct process_attr_tracker_value_comm value_comm = {
                        .type = (int32_t) value->type,
+                       .value = {},
        };
        const char *name = NULL;
 
@@ -425,7 +426,7 @@ struct process_attr_value *process_attr_value_copy(
                goto end;
        }
 
-       new_value = (process_attr_value *) zmalloc(sizeof(*new_value));
+       new_value = zmalloc<process_attr_value>();
        if (!new_value) {
                goto end;
        }
This page took 0.026151 seconds and 4 git commands to generate.