diff options
author | 2019-01-27 11:55:39 +0100 | |
---|---|---|
committer | 2019-02-06 10:00:38 -0300 | |
commit | 7b644f9ad18f74aeac42360bee9c4c1cf874f4c0 (patch) | |
tree | 70b183c8c15a087a94e39e56193fda27d5af9c15 /tools/perf/util/callchain.c | |
parent | perf srccode: Move struct definition from map.h to srccode.h (diff) | |
download | linux-7b644f9ad18f74aeac42360bee9c4c1cf874f4c0.tar.gz linux-7b644f9ad18f74aeac42360bee9c4c1cf874f4c0.tar.bz2 linux-7b644f9ad18f74aeac42360bee9c4c1cf874f4c0.zip |
perf callchain: Uninline callchain_cursor_reset() to remove map.h dependency
That was the only thing that made including map.h in callchain.h a
requiriment, so uninline it and just add a 'struct map' forward
declaration.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-7fjz4hvv1bpzqaeriku44fn4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r-- | tools/perf/util/callchain.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index dc2212e12184..2974950039ac 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -1577,3 +1577,18 @@ int callchain_cursor__copy(struct callchain_cursor *dst, return rc; } + +/* + * Initialize a cursor before adding entries inside, but keep + * the previously allocated entries as a cache. + */ +void callchain_cursor_reset(struct callchain_cursor *cursor) +{ + struct callchain_cursor_node *node; + + cursor->nr = 0; + cursor->last = &cursor->first; + + for (node = cursor->first; node != NULL; node = node->next) + map__zput(node->map); +} |