From: Steven Rostedt <rostedt@goodmis.org>
To: Pierre Gondois <pierre.gondois@arm.com>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH v4] trace-cmd split: Enable support for buffer selection
Date: Thu, 15 Feb 2024 22:24:27 -0500 [thread overview]
Message-ID: <20240215222427.71746f76@gandalf.local.home> (raw)
In-Reply-To: <20240214174013.68568-1-pierre.gondois@arm.com>
On Wed, 14 Feb 2024 18:40:13 +0100
Pierre Gondois <pierre.gondois@arm.com> wrote:
> --- a/tracecmd/trace-split.c
> +++ b/tracecmd/trace-split.c
> @@ -55,13 +55,10 @@ struct handle_list {
> struct list_head list;
> const char *name;
> int index;
> - struct tracecmd_input *handle;
> + struct tracecmd_input *handle;
>
> /* Identify the top instance in the input trace. */
> bool was_top_instance;
> -
> - /* Identify the top instance in each output trace. */
> - bool is_top_instance;
> };
>
> static struct list_head handle_list;
> @@ -120,6 +117,51 @@ static void free_handles(struct list_head *list)
> }
> }
>
> +static struct list_head inst_list;
> +
> +struct inst_list {
> + struct list_head list;
> + const char *name;
> + struct handle_list *handle;
> +
> + /* Identify the top instance in the input trace. */
> + bool was_top_instance;
> +
> + /* Identify the top instance in the output trace. */
> + bool is_top_instance;
> +};
> +
> +static void free_inst(struct list_head *list)
> +{
> + struct inst_list *item;
> +
> + while (!list_empty(list)) {
> + item = container_of(list->next, struct inst_list, list);
> + list_del(&item->list);
> + free((char *)item->name);
> + free(item);
> + }
Nit, the above could be simplified as:
struct inst_list *item, *n;
list_for_each_entry_safe(item, n, head, list) {
list_del(&item->list);
free((char *)item->name);
free(item);
}
That way you don't need to deal with "container_of()".
> +}
> +
prev parent reply other threads:[~2024-02-16 3:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 17:40 [PATCH v4] trace-cmd split: Enable support for buffer selection Pierre Gondois
2024-02-16 3:24 ` Steven Rostedt [this message]
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=20240215222427.71746f76@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=pierre.gondois@arm.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 read-only IMAP folder(s) and NNTP newsgroup(s).