projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add type-checked versions of allocation and deallocations functions
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
list.cpp
diff --git
a/src/bin/lttng/commands/list.cpp
b/src/bin/lttng/commands/list.cpp
index 4bb681e09c1a9dca8850242dfc156c98beb8e62e..8636cd101850d5557e489e2671add4ede354e4cc 100644
(file)
--- a/
src/bin/lttng/commands/list.cpp
+++ b/
src/bin/lttng/commands/list.cpp
@@
-1,5
+1,5
@@
/*
/*
- * 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
* Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
* SPDX-License-Identifier: GPL-2.0-only
@@
-14,13
+14,13
@@
#include <stdlib.h>
#include <string.h>
#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.h
pp
>
+#include <common/time.h
pp
>
+#include <common/tracker.h
pp
>
+#include <lttng/domain-internal.h
pp
>
#include <lttng/lttng.h>
#include <lttng/lttng.h>
-#include "../command.h"
+#include "../command.h
pp
"
static int opt_userspace;
static int opt_kernel;
static int opt_userspace;
static int opt_kernel;
@@
-91,11
+91,12
@@
static char *get_cmdline_by_pid(pid_t pid)
}
/* Caller must free() *cmdline */
}
/* Caller must free() *cmdline */
- cmdline =
(char *) zmalloc
(PATH_MAX);
+ cmdline =
zmalloc<char>
(PATH_MAX);
if (!cmdline) {
PERROR("malloc cmdline");
goto end;
}
if (!cmdline) {
PERROR("malloc cmdline");
goto end;
}
+
ret = fread(cmdline, 1, PATH_MAX, fp);
if (ret < 0) {
PERROR("fread proc list");
ret = fread(cmdline, 1, PATH_MAX, fp);
if (ret < 0) {
PERROR("fread proc list");
@@
-338,13
+339,8
@@
static void print_events(struct lttng_event *event)
if (ret) {
filter_msg = strdup(" [failed to retrieve filter]");
} else if (filter_str) {
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;
}
}
}
}
@@
-1151,14
+1147,8
@@
static int list_session_agent_events(void)
if (ret) {
filter_msg = strdup(" [failed to retrieve filter]");
} else if (filter_str) {
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;
}
}
}
}
This page took
0.025147 seconds
and
4
git commands to generate.