X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Ftracker.cpp;h=41e141afe63ae36e09e3caa9f5bb9b21f07331c3;hb=2d7da3031c65c4569ff2428a7c2cad30007f3b50;hp=84b6c6b8f11c33f31039f711ddb0061f5d6ae568;hpb=a6bc4ca9d659caf016ef932fcd944029737ac57c;p=lttng-tools.git diff --git a/src/common/tracker.cpp b/src/common/tracker.cpp index 84b6c6b8f..41e141afe 100644 --- a/src/common/tracker.cpp +++ b/src/common/tracker.cpp @@ -10,17 +10,19 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +#include + struct process_attr_tracker_values_comm_header { uint32_t count; -}; +} LTTNG_PACKED; struct process_attr_tracker_value_comm { /* enum lttng_process_attr_value_type */ @@ -30,19 +32,19 @@ struct process_attr_tracker_value_comm { /* Includes the '\0' terminator. */ uint32_t name_len; } value; -}; +} LTTNG_PACKED; #define GET_INTEGRAL_COMM_VALUE(value_ptr, as_type) \ - ((as_type)(is_signed(as_type) ? (value_ptr)->u._signed : \ + ((as_type)(std::is_signed::value ? (value_ptr)->u._signed : \ (value_ptr)->u._unsigned)) -#define SET_INTEGRAL_COMM_VALUE(comm_value, value) \ - if (is_signed(typeof(value))) { \ +#define SET_INTEGRAL_COMM_VALUE(comm_value, val) \ + if (std::is_signed::value) { \ (comm_value)->u._signed = \ - (typeof((comm_value)->u._signed)) value; \ + (typeof((comm_value)->u._signed)) val; \ } else { \ (comm_value)->u._unsigned = \ - (typeof((comm_value)->u._unsigned)) value; \ + (typeof((comm_value)->u._unsigned)) val; \ } static inline bool is_virtual_process_attr(enum lttng_process_attr process_attr) @@ -69,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(); if (!value) { ret = LTTNG_ERR_NOMEM; @@ -212,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(); if (!values) { goto end; @@ -245,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; @@ -423,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(); if (!new_value) { goto end; }