[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191107190011.23924-30-acme@kernel.org>
Date: Thu, 7 Nov 2019 15:59:37 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Clark Williams <williams@...hat.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH 29/63] perf map: Allow map__next() to receive a NULL arg
From: Arnaldo Carvalho de Melo <acme@...hat.com>
Just like free(), return NULL in that case, will simplify the
for_each_entry_safe() iterators.
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Link: https://lkml.kernel.org/n/tip-pbde2ucn49khnrebclys9pny@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/map.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index c9ba49566981..86d8d187f872 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -1007,7 +1007,7 @@ struct map *maps__first(struct maps *maps)
return NULL;
}
-struct map *map__next(struct map *map)
+static struct map *__map__next(struct map *map)
{
struct rb_node *next = rb_next(&map->rb_node);
@@ -1016,6 +1016,11 @@ struct map *map__next(struct map *map)
return NULL;
}
+struct map *map__next(struct map *map)
+{
+ return map ? __map__next(map) : NULL;
+}
+
struct kmap *__map__kmap(struct map *map)
{
if (!map->dso || !map->dso->kernel)
--
2.21.0
Powered by blists - more mailing lists