linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 13/19] tools lib traceevent: Add destructor for format_field
Date: Sat, 21 Mar 2015 15:54:32 -0300	[thread overview]
Message-ID: <1426964078-16384-14-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1426964078-16384-1-git-send-email-acme@kernel.org>

From: David Ahern <dsahern@gmail.com>

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 afe20ed9fac8..d7c37a7d9255 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 5b4efc062320..6abda54d76f2 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,
-- 
1.9.3


  parent reply	other threads:[~2015-03-21 18:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21 18:54 [GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 01/19] perf tools: Fix race in build_id_cache__add_s() Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 02/19] perf tools: Don't allow empty argument for field-separator Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 03/19] perf build: Use FEATURE-DUMP instead of PERF-FEATURES in the .gitignore file Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 04/19] perf build: Add config/feature-checks/*.output to " Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 05/19] perf probe: Fix failure to add multiple probes without debuginfo Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 06/19] perf trace: Fix summary_only option Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 07/19] perf build: Fix feature_check name clash Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 08/19] perf build: Separate feature make support into config/Makefile.feature Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 09/19] perf build: Make features checks directory configurable Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 10/19] perf build: Move feature checks code under tools/build Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 11/19] perf trace: Handle legacy syscalls tracepoints Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 12/19] perf hists browser: Indicate which callchain entries are annotated Arnaldo Carvalho de Melo
2015-03-21 18:54 ` Arnaldo Carvalho de Melo [this message]
2015-03-21 18:54 ` [PATCH 14/19] tools build: Add feature check for lzma library Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 15/19] perf tools: Add lzma decompression support for kernel module Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 16/19] perf tools: Add kmod_path__parse function Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 17/19] perf tools: Add dsos__addnew function Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 18/19] perf tools: Add machine__module_dso function Arnaldo Carvalho de Melo
2015-03-21 18:54 ` [PATCH 19/19] perf tools: Use kmod_path__parse for machine__new_dso Arnaldo Carvalho de Melo
2015-03-22  9:58 ` [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar

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=1426964078-16384-14-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /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).