diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-10-28 11:50:12 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-11-06 15:43:06 -0300 |
commit | 20419d3a5bc0a278ed7e2ee54943674004411933 (patch) | |
tree | 06090a146ff0c0f142108d608d96a6534facc862 /tools/perf | |
parent | ee2555b612869a763563c5389ad789a52db0afd1 (diff) |
perf map: Allow map__next() to receive a NULL arg
Just like free(), return NULL in that case, will simplify the
for_each_entry_safe() iterators.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-pbde2ucn49khnrebclys9pny@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/map.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) |