#include <urcu/list.h>
-#include <lttng/domain-internal.h>
-#include <common/mi-lttng.h>
+#include <lttng/domain-internal.hpp>
+#include <common/mi-lttng.hpp>
-#include "../command.h"
+#include "../command.hpp"
static char *opt_channel_name;
static char *opt_session_name;
_PERF_HW_CACHE(optstr "-prefetch-misses", name, type, \
PREFETCH, MISS, hide)
-static
+namespace {
const struct ctx_opts {
/* Needed for end-of-list item. */
ctx_opts()
{ (char *) "need_reschedule", CONTEXT_NEED_RESCHEDULE },
{ (char *) "migratable", CONTEXT_MIGRATABLE },
{ (char *) "callstack-kernel", CONTEXT_CALLSTACK_KERNEL },
-#if HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT
+#ifdef HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT
{ (char *) "callstack-user", CONTEXT_CALLSTACK_USER },
#endif
{ (char *) "cgroup_ns", CONTEXT_CGROUP_NS },
} ctx_type_list = {
.head = CDS_LIST_HEAD_INIT(ctx_type_list.head),
};
-
-
+} /* namespace */
/*
* Find context numerical value from string.
if (type->opt) {
free(type->opt->symbol);
}
- free(type->opt);
+ delete type->opt;
free(type);
}
static
struct ctx_type *create_ctx_type(void)
{
- struct ctx_type *type = (ctx_type *) zmalloc(sizeof(*type));
+ struct ctx_type *type = zmalloc<ctx_type>();
if (!type) {
PERROR("malloc ctx_type");
goto end;
}
- type->opt = (struct ctx_opts *) zmalloc(sizeof(*type->opt));
+ type->opt = new struct ctx_opts;
if (!type->opt) {
PERROR("malloc ctx_type options");
destroy_ctx_type(type);
}
provider_name_len = colon_pos - sizeof(app_ctx_prefix) + 2;
- provider_name = (char *) zmalloc(provider_name_len);
+ provider_name = calloc<char>(provider_name_len);
if (!provider_name) {
PERROR("malloc provider_name");
goto not_found;
type->opt->u.app_ctx.provider_name = provider_name;
ctx_name_len = len - colon_pos;
- ctx_name = (char *) zmalloc(ctx_name_len);
+ ctx_name = calloc<char>(ctx_name_len);
if (!ctx_name) {
PERROR("malloc ctx_name");
goto not_found;