/*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 EfficiOS Inc.
* Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
* SPDX-License-Identifier: GPL-2.0-only
#include <stdlib.h>
#include <string.h>
-#include <common/mi-lttng.h>
-#include <common/time.h>
-#include <common/tracker.h>
-#include <lttng/domain-internal.h>
+#include <common/mi-lttng.hpp>
+#include <common/time.hpp>
+#include <common/tracker.hpp>
+#include <lttng/domain-internal.hpp>
#include <lttng/lttng.h>
-#include "../command.h"
+#include "../command.hpp"
static int opt_userspace;
static int opt_kernel;
if (ret) {
filter_msg = strdup(" [failed to retrieve filter]");
} else if (filter_str) {
- const char * const filter_fmt = " [filter: '%s']";
-
- filter_msg = (char *) malloc(strlen(filter_str) +
- strlen(filter_fmt) + 1);
- if (filter_msg) {
- sprintf(filter_msg, filter_fmt,
- filter_str);
+ if (asprintf(&filter_msg, " [filter: '%s']", filter_str) == -1) {
+ filter_msg = NULL;
}
}
if (ret) {
filter_msg = strdup(" [failed to retrieve filter]");
} else if (filter_str) {
- const char * const filter_fmt =
- " [filter: '%s']";
-
- filter_msg = (char *) malloc(strlen(filter_str) +
- strlen(filter_fmt) + 1);
- if (filter_msg) {
- sprintf(filter_msg, filter_fmt,
- filter_str);
+ if (asprintf(&filter_msg, " [filter: '%s']", filter_str) == -1) {
+ filter_msg = NULL;
}
}