[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-djbgpcfo5udqptx3q0flwtmk@git.kernel.org>
Date: Fri, 31 Jul 2015 06:53:52 -0700
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: bp@...e.de, tglx@...utronix.de, namhyung@...nel.org,
adrian.hunter@...el.com, jolsa@...hat.com, eranian@...gle.com,
hpa@...or.com, acme@...hat.com, mingo@...nel.org,
fweisbec@...il.com, kan.liang@...el.com,
linux-kernel@...r.kernel.org, dsahern@...il.com
Subject: [tip:perf/core] perf session env: Rename exit method
Commit-ID: 4c7de49a2977aa2a0f556c803afbb24848372e7a
Gitweb: http://git.kernel.org/tip/4c7de49a2977aa2a0f556c803afbb24848372e7a
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Wed, 29 Jul 2015 12:18:24 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 29 Jul 2015 12:59:03 -0300
perf session env: Rename exit method
The semantic associated in tools/perf/ with foo__delete(instance) is to
release all resources referenced by 'instance' members and then release
the memory for 'instance' itself.
The perf_session_env__delete() function isn't doing this, it just does
the first part, but the space used by 'instance' itself isn't freed, as
it is embedded in a larger structure, that will be freed at other stage.
For these cases we se foo__exit(), i.e. the usage is:
void foo__delete(foo)
{
if (foo) {
foo__exit(foo);
free(foo);
}
}
But when we have something like:
struct bar {
struct foo foo;
. . .
}
Then we can't really call foo__delete(&bar.foo), we must have this
instead:
void bar__exit(bar)
{
foo__exit(&bar.foo);
/* free other bar-> resources */
}
void bar__delete(bar)
{
if (bar) {
bar__exit(bar);
free(bar);
}
}
So just rename perf_session_env__delete() to perf_session_env__exit().
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Borislav Petkov <bp@...e.de>
Cc: David Ahern <dsahern@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Kan Liang <kan.liang@...el.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Stephane Eranian <eranian@...gle.com>
Link: http://lkml.kernel.org/n/tip-djbgpcfo5udqptx3q0flwtmk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/session.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 2d95747..f51eb54 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -170,7 +170,7 @@ static void perf_session__delete_threads(struct perf_session *session)
machine__delete_threads(&session->machines.host);
}
-static void perf_session_env__delete(struct perf_session_env *env)
+static void perf_session_env__exit(struct perf_session_env *env)
{
zfree(&env->hostname);
zfree(&env->os_release);
@@ -193,7 +193,7 @@ void perf_session__delete(struct perf_session *session)
auxtrace_index__free(&session->auxtrace_index);
perf_session__destroy_kernel_maps(session);
perf_session__delete_threads(session);
- perf_session_env__delete(&session->header.env);
+ perf_session_env__exit(&session->header.env);
machines__exit(&session->machines);
if (session->file)
perf_data_file__close(session->file);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists