From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v3 2/6] libtracefs: Change get name API to return constant string
Date: Thu, 12 Nov 2020 14:10:02 -0500 [thread overview]
Message-ID: <20201112141002.5eb30000@gandalf.local.home> (raw)
In-Reply-To: <20201112091109.1239169-3-tz.stoyanov@gmail.com>
On Thu, 12 Nov 2020 11:11:05 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> The tracefs_instance_get_name() API returns a pointer to internal
> string. This string is not meant to be changed by the API callers,
> that's why it should be constant.
>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
> include/tracefs/tracefs.h | 2 +-
> lib/tracefs/tracefs-events.c | 12 ++----------
> lib/tracefs/tracefs-instance.c | 2 +-
> tracecmd/trace-record.c | 2 +-
> utest/tracefs-utest.c | 2 +-
> 5 files changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/include/tracefs/tracefs.h b/include/tracefs/tracefs.h
> index 8ee7ba6e..1cf8de48 100644
> --- a/include/tracefs/tracefs.h
> +++ b/include/tracefs/tracefs.h
> @@ -24,7 +24,7 @@ struct tracefs_instance *tracefs_instance_alloc(const char *name);
> void tracefs_instance_free(struct tracefs_instance *instance);
> int tracefs_instance_create(struct tracefs_instance *instance);
> int tracefs_instance_destroy(struct tracefs_instance *instance);
> -char *tracefs_instance_get_name(struct tracefs_instance *instance);
> +const char *tracefs_instance_get_name(struct tracefs_instance *instance);
> char *
> tracefs_instance_get_file(struct tracefs_instance *instance, const char *file);
> char *tracefs_instance_get_dir(struct tracefs_instance *instance);
> diff --git a/lib/tracefs/tracefs-events.c b/lib/tracefs/tracefs-events.c
> index 8e825f50..6b796382 100644
> --- a/lib/tracefs/tracefs-events.c
> +++ b/lib/tracefs/tracefs-events.c
> @@ -481,11 +481,7 @@ next_event:
> failure = ret;
> }
>
> - if (events) {
> - for (i = 0; events[i]; i++)
> - free(events[i]);
> - free(events);
> - }
> + tracefs_list_free(events);
> return failure;
> }
>
> @@ -564,11 +560,7 @@ static int fill_local_events_system(const char *tracing_dir,
> /* always succeed because parsing failures are not critical */
> ret = 0;
> out:
> - if (systems) {
> - for (i = 0; systems[i]; i++)
> - free(systems[i]);
> - free(systems);
> - }
> + tracefs_list_free(systems);
> return ret;
> }
>
The above looks like it belongs in its own patch (not related to this
change).
-- Steve
next prev parent reply other threads:[~2020-11-12 19:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 9:11 [PATCH v3 0/6] libtracefs fixes and improvements Tzvetomir Stoyanov (VMware)
2020-11-12 9:11 ` [PATCH v3 1/6] trace-cmd: Change tracefs.h include path Tzvetomir Stoyanov (VMware)
2020-11-12 9:11 ` [PATCH v3 2/6] libtracefs: Change get name API to return constant string Tzvetomir Stoyanov (VMware)
2020-11-12 19:10 ` Steven Rostedt [this message]
2020-11-12 9:11 ` [PATCH v3 3/6] libtracefs: Add new API to check if instance exists Tzvetomir Stoyanov (VMware)
2020-11-12 9:11 ` [PATCH v3 4/6] libtracefs: Combine allocate and create APIs into one Tzvetomir Stoyanov (VMware)
2020-11-12 19:14 ` Steven Rostedt
2020-11-12 9:11 ` [PATCH v3 5/6] libtracefs: Add new tracefs API tracefs_instances_walk() Tzvetomir Stoyanov (VMware)
2020-11-12 19:17 ` Steven Rostedt
2020-11-12 9:11 ` [PATCH v3 6/6] trace-cmd: Add new libtrasefs API to get the current trace clock Tzvetomir Stoyanov (VMware)
2020-11-12 19:23 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201112141002.5eb30000@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tz.stoyanov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).