#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>
+#include <type_traits>
+
+namespace {
struct process_attr_tracker_values_comm_header {
uint32_t count;
-};
+} LTTNG_PACKED;
struct process_attr_tracker_value_comm {
/* enum lttng_process_attr_value_type */
/* Includes the '\0' terminator. */
uint32_t name_len;
} value;
-};
+} LTTNG_PACKED;
+} /* namespace */
#define GET_INTEGRAL_COMM_VALUE(value_ptr, as_type) \
- ((as_type)(is_signed(as_type) ? (value_ptr)->u._signed : \
+ ((as_type)(std::is_signed<as_type>::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<typeof(val)>::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)
{
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;
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;
int ret;
struct process_attr_tracker_value_comm value_comm = {
.type = (int32_t) value->type,
+ .value = {},
};
const char *name = NULL;
goto end;
}
- new_value = (process_attr_value *) zmalloc(sizeof(*new_value));
+ new_value = zmalloc<process_attr_value>();
if (!new_value) {
goto end;
}