perf maps: Re-use __maps__free_maps_by_name()
authorJames Clark <james.clark@arm.com>
Tue, 7 May 2024 14:12:06 +0000 (15:12 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 9 May 2024 21:48:19 +0000 (18:48 -0300)
commitfd81f52e311f11f3eba842439948f989ffa8ccc2
tree32a9e637f721ab3a1d311152b7a3838d4255b963
parent9fe410a7ef483a9aca08bf620d8ddfd35ac99bc7
perf maps: Re-use __maps__free_maps_by_name()

maps__merge_in() hard codes the steps to free the maps_by_name list. It
seems to not map__put() each element before freeing, and it sets
maps_by_name_sorted to true after freeing, which may be harmless but
is inconsistent with maps__init() and other functions.

maps__maps_by_name_addr() is also quite hard to read because we already
have maps__maps_by_name() and maps__maps_by_address(), but the function
is only used in that place so delete it.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240507141210.195939-3-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/maps.c