mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for David Ahern <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, rostedt@goodmis.org,
	linux-kernel@vger.kernel.org, hpa@zytor.com, dsahern@gmail.com,
	acme@redhat.com, mingo@kernel.org
Subject: [tip:perf/core] tools lib traceevent: Add destructor for format_field
Date: Sun, 22 Mar 2015 03:17:20 -0700	[thread overview]
Message-ID: <tip-00ae1127a03d20f5ef89f3c1fe7d4720270fc2a5@git.kernel.org> (raw)
In-Reply-To: <1426790181-19118-1-git-send-email-dsahern@gmail.com>

Commit-ID:  00ae1127a03d20f5ef89f3c1fe7d4720270fc2a5
Gitweb:     http://git.kernel.org/tip/00ae1127a03d20f5ef89f3c1fe7d4720270fc2a5
Author:     David Ahern <dsahern@gmail.com>
AuthorDate: Thu, 19 Mar 2015 12:36:21 -0600
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 21 Mar 2015 14:53:38 -0300

tools lib traceevent: Add destructor for format_field

Move the calls that frees the resources allocated for a struct format_field to
a separate routine.

Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1426790181-19118-1-git-send-email-dsahern@gmail.com
[ Split this part from a larger patch, added pevent_ prefix as requested by Steven ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 11 ++++++++---
 tools/lib/traceevent/event-parse.h |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index afe20ed..d7c37a7 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -6228,15 +6228,20 @@ void pevent_ref(struct pevent *pevent)
 	pevent->ref_count++;
 }
 
+void pevent_free_format_field(struct format_field *field)
+{
+	free(field->type);
+	free(field->name);
+	free(field);
+}
+
 static void free_format_fields(struct format_field *field)
 {
 	struct format_field *next;
 
 	while (field) {
 		next = field->next;
-		free(field->type);
-		free(field->name);
-		free(field);
+		pevent_free_format_field(field);
 		field = next;
 	}
 }
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 5b4efc0..6abda54 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -619,6 +619,7 @@ enum pevent_errno pevent_parse_format(struct pevent *pevent,
 				      const char *buf,
 				      unsigned long size, const char *sys);
 void pevent_free_format(struct event_format *event);
+void pevent_free_format_field(struct format_field *field);
 
 void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
 			   const char *name, struct pevent_record *record,

      parent reply	other threads:[~2015-03-22 10:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 18:36 [PATCH] perf trace: Handle legacy syscalls David Ahern
2015-03-20 15:32 ` Arnaldo Carvalho de Melo
2015-03-20 15:40   ` Steven Rostedt
2015-03-20 15:44     ` Arnaldo Carvalho de Melo
2015-03-20 15:48       ` David Ahern
2015-03-20 15:48   ` David Ahern
2015-03-20 16:06     ` Arnaldo Carvalho de Melo
2015-03-20 16:12       ` David Ahern
2015-03-20 16:26         ` Arnaldo Carvalho de Melo
2015-03-20 16:30           ` David Ahern
2015-03-22 10:17 ` tip-bot for David Ahern [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=tip-00ae1127a03d20f5ef89f3c1fe7d4720270fc2a5@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome