From 7f7c536f23e6afaa5d5d4b0e0958b0be8922491f Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 4 Jul 2019 11:32:27 -0300 Subject: [PATCH] tools lib: Adopt zalloc()/zfree() from tools/perf Eroding a bit more the tools/perf/util/util.h hodpodge header. Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Link: https://lkml.kernel.org/n/tip-natazosyn9rwjka25tvcnyi0@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/linux/zalloc.h | 12 ++++++++++++ tools/lib/zalloc.c | 15 +++++++++++++++ tools/perf/MANIFEST | 1 + tools/perf/arch/arm/annotate/instructions.c | 1 + tools/perf/arch/arm/util/auxtrace.c | 1 + tools/perf/arch/arm/util/cs-etm.c | 1 + tools/perf/arch/arm64/util/arm-spe.c | 1 + tools/perf/arch/common.c | 2 +- tools/perf/arch/powerpc/util/perf_regs.c | 2 +- tools/perf/arch/s390/util/auxtrace.c | 1 + tools/perf/arch/s390/util/header.c | 2 +- tools/perf/arch/x86/util/event.c | 2 +- tools/perf/arch/x86/util/intel-bts.c | 2 +- tools/perf/arch/x86/util/intel-pt.c | 2 +- tools/perf/arch/x86/util/perf_regs.c | 2 +- tools/perf/bench/mem-functions.c | 2 +- tools/perf/bench/numa.c | 2 +- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-bench.c | 2 +- tools/perf/builtin-c2c.c | 2 +- tools/perf/builtin-diff.c | 2 +- tools/perf/builtin-help.c | 1 + tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-kvm.c | 2 +- tools/perf/builtin-lock.c | 2 +- tools/perf/builtin-probe.c | 2 +- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-sched.c | 2 +- tools/perf/builtin-script.c | 2 +- tools/perf/builtin-stat.c | 2 +- tools/perf/builtin-timechart.c | 4 +--- tools/perf/builtin-trace.c | 1 + tools/perf/perf.c | 2 +- tools/perf/tests/switch-tracking.c | 1 + tools/perf/ui/browser.c | 2 +- tools/perf/ui/browsers/annotate.c | 2 +- tools/perf/ui/browsers/hists.c | 2 +- tools/perf/ui/gtk/util.c | 3 +-- tools/perf/ui/stdio/hist.c | 2 +- tools/perf/util/Build | 5 +++++ tools/perf/util/arm-spe.c | 2 +- tools/perf/util/auxtrace.c | 2 +- tools/perf/util/bpf-loader.c | 1 + tools/perf/util/build-id.c | 1 + tools/perf/util/call-path.c | 3 ++- tools/perf/util/callchain.c | 2 +- tools/perf/util/cgroup.c | 2 +- tools/perf/util/comm.c | 2 +- tools/perf/util/config.c | 3 +-- tools/perf/util/counts.c | 2 +- tools/perf/util/cpumap.c | 2 +- tools/perf/util/cputopo.c | 2 +- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 1 + tools/perf/util/cs-etm.c | 1 + tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/data.c | 1 + tools/perf/util/db-export.c | 2 +- tools/perf/util/dso.c | 3 ++- tools/perf/util/env.c | 2 +- tools/perf/util/event.c | 1 + tools/perf/util/evlist.c | 2 +- tools/perf/util/evsel.c | 2 +- tools/perf/util/header.c | 2 +- tools/perf/util/help-unknown-cmd.c | 2 ++ tools/perf/util/hist.c | 2 +- tools/perf/util/intel-bts.c | 2 +- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 +- tools/perf/util/intel-pt.c | 2 +- tools/perf/util/llvm-utils.c | 1 + tools/perf/util/machine.c | 2 +- tools/perf/util/map.c | 2 +- tools/perf/util/mem2node.c | 2 +- tools/perf/util/mmap.c | 1 + tools/perf/util/namespaces.c | 2 +- tools/perf/util/parse-events.c | 1 + tools/perf/util/pmu.c | 2 +- tools/perf/util/probe-event.c | 2 +- tools/perf/util/probe-file.c | 2 +- tools/perf/util/probe-finder.c | 2 +- tools/perf/util/pstack.c | 2 +- tools/perf/util/python-ext-sources | 1 + tools/perf/util/s390-cpumsf.c | 2 +- tools/perf/util/session.c | 2 +- tools/perf/util/srcline.c | 2 +- tools/perf/util/stat.c | 1 + tools/perf/util/strbuf.c | 2 +- tools/perf/util/strfilter.c | 3 ++- tools/perf/util/strlist.c | 2 +- tools/perf/util/svghelper.c | 2 +- tools/perf/util/symbol-elf.c | 1 + tools/perf/util/symbol-minimal.c | 2 +- tools/perf/util/symbol.c | 1 + tools/perf/util/syscalltbl.c | 2 +- tools/perf/util/thread-stack.c | 2 +- tools/perf/util/thread.c | 2 +- tools/perf/util/thread_map.c | 2 +- tools/perf/util/trace-event-info.c | 1 + tools/perf/util/trace-event-scripting.c | 2 +- tools/perf/util/unwind-libdw.c | 1 + tools/perf/util/util.h | 9 --------- tools/perf/util/values.c | 2 +- tools/perf/util/vdso.c | 1 + tools/perf/util/xyarray.c | 2 +- 103 files changed, 135 insertions(+), 86 deletions(-) create mode 100644 tools/include/linux/zalloc.h create mode 100644 tools/lib/zalloc.c diff --git a/tools/include/linux/zalloc.h b/tools/include/linux/zalloc.h new file mode 100644 index 0000000..81099c8 --- /dev/null +++ b/tools/include/linux/zalloc.h @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: LGPL-2.1 +#ifndef __TOOLS_LINUX_ZALLOC_H +#define __TOOLS_LINUX_ZALLOC_H + +#include + +void *zalloc(size_t size); +void __zfree(void **ptr); + +#define zfree(ptr) __zfree((void **)(ptr)) + +#endif // __TOOLS_LINUX_ZALLOC_H diff --git a/tools/lib/zalloc.c b/tools/lib/zalloc.c new file mode 100644 index 0000000..9c856d5 --- /dev/null +++ b/tools/lib/zalloc.c @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: LGPL-2.1 + +#include +#include + +void *zalloc(size_t size) +{ + return calloc(1, size); +} + +void __zfree(void **ptr) +{ + free(*ptr); + *ptr = NULL; +} diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST index 6a5de44..70f1ff4 100644 --- a/tools/perf/MANIFEST +++ b/tools/perf/MANIFEST @@ -18,3 +18,4 @@ tools/lib/find_bit.c tools/lib/bitmap.c tools/lib/str_error_r.c tools/lib/vsprintf.c +tools/lib/zalloc.c diff --git a/tools/perf/arch/arm/annotate/instructions.c b/tools/perf/arch/arm/annotate/instructions.c index f64516d..c7d1a69 100644 --- a/tools/perf/arch/arm/annotate/instructions.c +++ b/tools/perf/arch/arm/annotate/instructions.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #include diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c index 1ce6bdb..0201474 100644 --- a/tools/perf/arch/arm/util/auxtrace.c +++ b/tools/perf/arch/arm/util/auxtrace.c @@ -6,6 +6,7 @@ #include #include +#include #include "../../util/auxtrace.h" #include "../../util/evlist.h" diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 2b83cc8..4208974 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "cs-etm.h" #include "../../perf.h" diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 5ccfce8..2c009aa 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "../../util/cpumap.h" diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c index 1bc3294..1a9e22f 100644 --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c @@ -3,8 +3,8 @@ #include #include "common.h" #include "../util/env.h" -#include "../util/util.h" #include "../util/debug.h" +#include const char *const arc_triplets[] = { "arc-linux-", diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c index 64f65c2..f14102b 100644 --- a/tools/perf/arch/powerpc/util/perf_regs.c +++ b/tools/perf/arch/powerpc/util/perf_regs.c @@ -2,9 +2,9 @@ #include #include #include +#include #include "../../perf.h" -#include "../../util/util.h" #include "../../util/perf_regs.h" #include "../../util/debug.h" diff --git a/tools/perf/arch/s390/util/auxtrace.c b/tools/perf/arch/s390/util/auxtrace.c index 44c8573..0fe1be9 100644 --- a/tools/perf/arch/s390/util/auxtrace.c +++ b/tools/perf/arch/s390/util/auxtrace.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "../../util/evlist.h" #include "../../util/auxtrace.h" diff --git a/tools/perf/arch/s390/util/header.c b/tools/perf/arch/s390/util/header.c index 165c5143..8b0b018 100644 --- a/tools/perf/arch/s390/util/header.c +++ b/tools/perf/arch/s390/util/header.c @@ -13,9 +13,9 @@ #include #include #include +#include #include "../../util/header.h" -#include "../../util/util.h" #define SYSINFO_MANU "Manufacturer:" #define SYSINFO_TYPE "Type:" diff --git a/tools/perf/arch/x86/util/event.c b/tools/perf/arch/x86/util/event.c index 675a021..a3a0b68 100644 --- a/tools/perf/arch/x86/util/event.c +++ b/tools/perf/arch/x86/util/event.c @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #include "../../util/machine.h" #include "../../util/tool.h" #include "../../util/map.h" -#include "../../util/util.h" #include "../../util/debug.h" #if defined(__x86_64__) diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c index e6d4d95..ec5c1bb 100644 --- a/tools/perf/arch/x86/util/intel-bts.c +++ b/tools/perf/arch/x86/util/intel-bts.c @@ -9,12 +9,12 @@ #include #include #include +#include #include "../../util/cpumap.h" #include "../../util/evsel.h" #include "../../util/evlist.h" #include "../../util/session.h" -#include "../../util/util.h" #include "../../util/pmu.h" #include "../../util/debug.h" #include "../../util/tsc.h" diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index 9804098..609088c 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "../../perf.h" @@ -25,7 +26,6 @@ #include "../../util/auxtrace.h" #include "../../util/tsc.h" #include "../../util/intel-pt.h" -#include "../../util/util.h" #define KiB(x) ((x) * 1024) #define MiB(x) ((x) * 1024 * 1024) diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index 3666c00..0d7b77f 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c @@ -2,9 +2,9 @@ #include #include #include +#include #include "../../perf.h" -#include "../../util/util.h" #include "../../util/perf_regs.h" #include "../../util/debug.h" diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c index 0251dd3..64dc994 100644 --- a/tools/perf/bench/mem-functions.c +++ b/tools/perf/bench/mem-functions.c @@ -9,7 +9,6 @@ #include "debug.h" #include "../perf.h" -#include "../util/util.h" #include #include "../util/header.h" #include "../util/cloexec.h" @@ -24,6 +23,7 @@ #include #include #include +#include #define K 1024 diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index a778455..a640ca7 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c @@ -11,7 +11,6 @@ #include "../perf.h" #include "../builtin.h" -#include "../util/util.h" #include #include "../util/cloexec.h" @@ -35,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 77deb3a..e0aa14f 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -8,11 +8,11 @@ */ #include "builtin.h" -#include "util/util.h" #include "util/color.h" #include #include "util/cache.h" #include +#include #include "util/symbol.h" #include "perf.h" diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c index 334c77f..b8e7c38 100644 --- a/tools/perf/builtin-bench.c +++ b/tools/perf/builtin-bench.c @@ -17,7 +17,6 @@ * epoll ... Event poll performance */ #include "perf.h" -#include "util/util.h" #include #include "builtin.h" #include "bench/bench.h" @@ -26,6 +25,7 @@ #include #include #include +#include typedef int (*bench_fn_t)(int argc, const char **argv); diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 9e6cc86..e3776f5 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -15,9 +15,9 @@ #include #include #include +#include #include #include -#include "util.h" #include "debug.h" #include "builtin.h" #include diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index f924b46..f6f5dd1 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -16,12 +16,12 @@ #include "util/tool.h" #include "util/sort.h" #include "util/symbol.h" -#include "util/util.h" #include "util/data.h" #include "util/config.h" #include "util/time-utils.h" #include "util/annotate.h" #include "util/map.h" +#include #include #include diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 6a1cab5..a83af92 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c @@ -14,6 +14,7 @@ #include #include "util/debug.h" #include +#include #include #include #include diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 9bd3829..9e5e608 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -4,7 +4,6 @@ #include "util/evlist.h" #include "util/evsel.h" -#include "util/util.h" #include "util/config.h" #include "util/map.h" #include "util/symbol.h" @@ -26,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index dbb6f73..b33c834 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -5,7 +5,6 @@ #include "util/evsel.h" #include "util/evlist.h" #include "util/term.h" -#include "util/util.h" #include "util/cache.h" #include "util/symbol.h" #include "util/thread.h" @@ -32,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index b9810a8..c0be44e 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -6,7 +6,6 @@ #include "util/evlist.h" #include "util/evsel.h" -#include "util/util.h" #include "util/cache.h" #include "util/symbol.h" #include "util/thread.h" @@ -30,6 +29,7 @@ #include #include #include +#include static struct perf_session *session; diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 8bb124e..6418782 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -19,7 +19,6 @@ #include "perf.h" #include "builtin.h" #include "namespaces.h" -#include "util/util.h" #include "util/strlist.h" #include "util/strfilter.h" #include "util/symbol.h" @@ -28,6 +27,7 @@ #include "util/probe-finder.h" #include "util/probe-event.h" #include "util/probe-file.h" +#include #define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*" #define DEFAULT_FUNC_FILTER "!_*" diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 93d4b12..abf0b9b 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -8,7 +8,6 @@ */ #include "builtin.h" -#include "util/util.h" #include "util/config.h" #include "util/annotate.h" @@ -16,6 +15,7 @@ #include #include #include +#include #include "util/map.h" #include "util/symbol.h" #include "util/callchain.h" diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 1519989..56d1907 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -2,7 +2,6 @@ #include "builtin.h" #include "perf.h" -#include "util/util.h" #include "util/evlist.h" #include "util/cache.h" #include "util/evsel.h" @@ -26,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 2f6232f..b353682 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -14,7 +14,6 @@ #include "util/symbol.h" #include "util/thread.h" #include "util/trace-event.h" -#include "util/util.h" #include "util/evlist.h" #include "util/evsel.h" #include "util/sort.h" @@ -34,6 +33,7 @@ #include #include #include +#include #include #include "asm/bug.h" #include "util/mem-events.h" diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index b81f7b1..c72f4a0 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -43,7 +43,6 @@ #include "perf.h" #include "builtin.h" #include "util/cgroup.h" -#include "util/util.h" #include #include "util/parse-events.h" #include "util/pmu.h" @@ -67,6 +66,7 @@ #include "asm/bug.h" #include +#include #include #include #include diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 145a196..4bde3fa 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -13,9 +13,6 @@ #include #include "builtin.h" - -#include "util/util.h" - #include "util/color.h" #include #include "util/cache.h" @@ -24,6 +21,7 @@ #include #include #include +#include #include "util/symbol.h" #include "util/thread.h" #include "util/callchain.h" diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index e3fc906..1aa2ed0 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -61,6 +61,7 @@ #include #include #include +#include #include #include diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 2123b3c..97e2628 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -18,7 +18,6 @@ #include "util/bpf-loader.h" #include "util/debug.h" #include "util/event.h" -#include "util/util.h" #include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include const char perf_usage_string[] = "perf [--version] [--help] [OPTIONS] COMMAND [ARGS]"; diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index 9b5be51..744409d 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "parse-events.h" #include "evlist.h" diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 55ff05a..f80c51d 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0 -#include "../util.h" #include "../string2.h" #include "../config.h" #include "../../perf.h" @@ -17,6 +16,7 @@ #include "keysyms.h" #include "../color.h" #include +#include static int ui_browser__percent_color(struct ui_browser *browser, double percent, bool current) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index b0d089a..e67880b 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0 -#include "../../util/util.h" #include "../browser.h" #include "../helpline.h" #include "../ui.h" @@ -15,6 +14,7 @@ #include #include #include +#include #include #include diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 33e67aa..85581cf 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "../../util/callchain.h" #include "../../util/evsel.h" @@ -18,7 +19,6 @@ #include "../../util/symbol.h" #include "../../util/pstack.h" #include "../../util/sort.h" -#include "../../util/util.h" #include "../../util/top.h" #include "../../util/thread.h" #include "../../arch/common.h" diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c index 7250d81..c28bdb7 100644 --- a/tools/perf/ui/gtk/util.c +++ b/tools/perf/ui/gtk/util.c @@ -1,11 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 #include "../util.h" -#include "../../util/util.h" #include "../../util/debug.h" #include "gtk.h" #include - +#include struct perf_gtk_context *pgctx; diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 89393c7..ee7ea6d 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c @@ -3,7 +3,6 @@ #include #include "../../util/callchain.h" -#include "../../util/util.h" #include "../../util/hist.h" #include "../../util/map.h" #include "../../util/map_groups.h" @@ -14,6 +13,7 @@ #include "../../util/string2.h" #include "../../util/thread.h" #include +#include static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin) { diff --git a/tools/perf/util/Build b/tools/perf/util/Build index d3408a4..d7e3b00 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -25,6 +25,7 @@ perf-y += rbtree.o perf-y += libstring.o perf-y += bitmap.o perf-y += hweight.o +perf-y += zalloc.o perf-y += smt.o perf-y += strbuf.o perf-y += string.o @@ -241,3 +242,7 @@ $(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE $(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE $(call rule_mkdir) $(call if_changed_dep,cc_o_c) + +$(OUTPUT)util/zalloc.o: ../lib/zalloc.c FORCE + $(call rule_mkdir) + $(call if_changed_dep,cc_o_c) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 6067267..a314e5b 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "cpumap.h" #include "color.h" @@ -19,7 +20,6 @@ #include "evlist.h" #include "machine.h" #include "session.h" -#include "util.h" #include "thread.h" #include "debug.h" #include "auxtrace.h" diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index bc215fe..0812a11 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -24,9 +24,9 @@ #include #include #include +#include #include "../perf.h" -#include "util.h" #include "evlist.h" #include "dso.h" #include "map.h" diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c index 251d9ea..93d0f23 100644 --- a/tools/perf/util/bpf-loader.c +++ b/tools/perf/util/bpf-loader.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "perf.h" #include "debug.h" diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 89c6913..f1abfab 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -30,6 +30,7 @@ #include "strlist.h" #include +#include static bool no_buildid_cache; diff --git a/tools/perf/util/call-path.c b/tools/perf/util/call-path.c index c5b9030..e8a80c4 100644 --- a/tools/perf/util/call-path.c +++ b/tools/perf/util/call-path.c @@ -6,8 +6,9 @@ #include #include +#include +#include -#include "util.h" #include "call-path.h" static void call_path__init(struct call_path *cp, struct call_path *parent, diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index abb608b..b4af25d 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -16,11 +16,11 @@ #include #include #include +#include #include "asm/bug.h" #include "hist.h" -#include "util.h" #include "sort.h" #include "machine.h" #include "map.h" diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c index ccd0263..f505d78 100644 --- a/tools/perf/util/cgroup.c +++ b/tools/perf/util/cgroup.c @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0 -#include "util.h" #include "../perf.h" #include #include "evsel.h" #include "cgroup.h" #include "evlist.h" #include +#include #include #include #include diff --git a/tools/perf/util/comm.c b/tools/perf/util/comm.c index 1066de9..afb8d4fd 100644 --- a/tools/perf/util/comm.c +++ b/tools/perf/util/comm.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 #include "comm.h" -#include "util.h" #include #include #include #include #include #include +#include #include "rwsem.h" struct comm_str { diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c index 752cce853..042ffbc 100644 --- a/tools/perf/util/config.c +++ b/tools/perf/util/config.c @@ -11,7 +11,6 @@ */ #include #include -#include "util.h" #include "cache.h" #include "callchain.h" #include @@ -23,7 +22,7 @@ #include #include #include - +#include #include #define MAXNAME (256) diff --git a/tools/perf/util/counts.c b/tools/perf/util/counts.c index 03032b4..88be9c4 100644 --- a/tools/perf/util/counts.c +++ b/tools/perf/util/counts.c @@ -3,7 +3,7 @@ #include #include "evsel.h" #include "counts.h" -#include "util.h" +#include struct perf_counts *perf_counts__new(int ncpus, int nthreads) { diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c index 0d8fbed..3acfbe3 100644 --- a/tools/perf/util/cpumap.c +++ b/tools/perf/util/cpumap.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0 -#include "util.h" #include #include "../perf.h" #include "cpumap.h" @@ -11,6 +10,7 @@ #include "asm/bug.h" #include +#include static int max_cpu_num; static int max_present_cpu_num; diff --git a/tools/perf/util/cputopo.c b/tools/perf/util/cputopo.c index d3b2bd2..fa1778a 100644 --- a/tools/perf/util/cputopo.c +++ b/tools/perf/util/cputopo.c @@ -4,10 +4,10 @@ #include #include #include +#include #include "cputopo.h" #include "cpumap.h" -#include "util.h" #include "env.h" #define CORE_SIB_FMT \ diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index bb45e23..37d7c49 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 0c7776b..d92516e 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index 7b06e73..1e93f2e 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -22,7 +23,6 @@ #include "asm/bug.h" #include "data-convert-bt.h" #include "session.h" -#include "util.h" #include "debug.h" #include "tool.h" #include "evlist.h" diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 6a64f71..df7e000 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #include #include #include diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c index 4cdd1f5..3f2694c 100644 --- a/tools/perf/util/db-export.c +++ b/tools/perf/util/db-export.c @@ -14,11 +14,11 @@ #include "symbol.h" #include "map.h" #include "event.h" -#include "util.h" #include "thread-stack.h" #include "callchain.h" #include "call-path.h" #include "db-export.h" +#include struct deferred_export { struct list_head node; diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index c7fde04..ebacf07 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,7 @@ #include "dso.h" #include "machine.h" #include "auxtrace.h" -#include "util.h" +#include "util.h" /* O_CLOEXEC for older systems */ #include "debug.h" #include "string2.h" #include "vdso.h" diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 7d317d4..f92d992 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -2,7 +2,7 @@ #include "cpumap.h" #include "env.h" #include -#include "util.h" +#include #include "bpf-event.h" #include #include diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index e1d0c5b..7524bda 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -11,6 +11,7 @@ #include /* To get things like MAP_HUGETLB even on older libc headers */ #include #include +#include #include "event.h" #include "debug.h" #include "hist.h" diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index a474ede..b0364d9 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -5,7 +5,6 @@ * Parts came from builtin-{top,stat,record}.c, see those files for further * copyright notes. */ -#include "util.h" #include #include #include @@ -33,6 +32,7 @@ #include #include #include +#include #ifdef LACKS_SIGQUEUE_PROTOTYPE int sigqueue(pid_t pid, int sig, const union sigval value); diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 7fb4ae8..7ede674 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +28,6 @@ #include "event.h" #include "evsel.h" #include "evlist.h" -#include "util.h" #include "cpumap.h" #include "thread_map.h" #include "target.h" diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 6a93ff5..4e2efaa 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include #include -#include "util.h" #include "string2.h" #include #include @@ -15,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/tools/perf/util/help-unknown-cmd.c b/tools/perf/util/help-unknown-cmd.c index 4f07a5ba..ab9e161 100644 --- a/tools/perf/util/help-unknown-cmd.c +++ b/tools/perf/util/help-unknown-cmd.c @@ -3,9 +3,11 @@ #include "config.h" #include #include +#include #include #include "../builtin.h" #include "levenshtein.h" +#include static int autocorrect; diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 27cecb5..bb1d773 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 #include "callchain.h" -#include "util.h" #include "build-id.h" #include "hist.h" #include "map.h" @@ -20,6 +19,7 @@ #include #include #include +#include static bool hists__filter_entry_by_dso(struct hists *hists, struct hist_entry *he); diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index e32dbff..5a21bcd 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "cpumap.h" #include "color.h" @@ -21,7 +22,6 @@ #include "map.h" #include "symbol.h" #include "session.h" -#include "util.h" #include "thread.h" #include "thread-stack.h" #include "debug.h" diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c index 4d14e78..3bfdf2b 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -14,9 +14,9 @@ #include #include #include +#include #include "../cache.h" -#include "../util.h" #include "../auxtrace.h" #include "intel-pt-insn-decoder.h" diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index 470aaae..c76a96f 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "../perf.h" #include "session.h" @@ -22,7 +23,6 @@ #include "evsel.h" #include "map.h" #include "color.h" -#include "util.h" #include "thread.h" #include "thread-stack.h" #include "symbol.h" diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c index 5b0b60f0..b9fddb8 100644 --- a/tools/perf/util/llvm-utils.c +++ b/tools/perf/util/llvm-utils.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "debug.h" #include "llvm-utils.h" #include "config.h" diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 147ed85..f523da3 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -15,7 +15,6 @@ #include "strlist.h" #include "thread.h" #include "vdso.h" -#include "util.h" #include #include #include @@ -28,6 +27,7 @@ #include #include #include +#include static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock); diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 5f87975..668410b 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -12,10 +12,10 @@ #include "thread.h" #include "vdso.h" #include "build-id.h" -#include "util.h" #include "debug.h" #include "machine.h" #include +#include #include "srcline.h" #include "namespaces.h" #include "unwind.h" diff --git a/tools/perf/util/mem2node.c b/tools/perf/util/mem2node.c index c6fd81c..cacc2fc 100644 --- a/tools/perf/util/mem2node.c +++ b/tools/perf/util/mem2node.c @@ -1,8 +1,8 @@ #include #include #include +#include #include "mem2node.h" -#include "util.h" struct phys_entry { struct rb_node rb_node; diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 768c632..9f0b639 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -9,6 +9,7 @@ #include #include #include +#include #ifdef HAVE_LIBNUMA_SUPPORT #include #endif diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c index fda2fa1..46d3a77 100644 --- a/tools/perf/util/namespaces.c +++ b/tools/perf/util/namespaces.c @@ -5,7 +5,6 @@ */ #include "namespaces.h" -#include "util.h" #include "event.h" #include "get_current_dir_name.h" #include @@ -18,6 +17,7 @@ #include #include #include +#include struct namespaces *namespaces__new(struct namespaces_event *event) { diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index cf0b9b8..aa439853 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #include #include #include diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 55f4de6..12b6779 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include #include -#include "util.h" #include "pmu.h" #include "parse-events.h" #include "cpumap.h" diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 6f24eaf..80c0eca 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -19,7 +19,6 @@ #include #include -#include "util.h" #include "event.h" #include "namespaces.h" #include "strlist.h" @@ -40,6 +39,7 @@ #include "string2.h" #include +#include #define PERFPROBE_GROUP "probe" diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c index 0ed19004..c2998f90 100644 --- a/tools/perf/util/probe-file.c +++ b/tools/perf/util/probe-file.c @@ -10,8 +10,8 @@ #include #include #include +#include #include "namespaces.h" -#include "util.h" #include "event.h" #include "strlist.h" #include "strfilter.h" diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 6b40cc6..7d8c997 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -19,11 +19,11 @@ #include #include +#include #include "event.h" #include "dso.h" #include "debug.h" #include "intlist.h" -#include "util.h" #include "strlist.h" #include "symbol.h" #include "probe-finder.h" diff --git a/tools/perf/util/pstack.c b/tools/perf/util/pstack.c index 797fe1a..28de8a4 100644 --- a/tools/perf/util/pstack.c +++ b/tools/perf/util/pstack.c @@ -5,10 +5,10 @@ * (c) 2010 Arnaldo Carvalho de Melo */ -#include "util.h" #include "pstack.h" #include "debug.h" #include +#include #include struct pstack { diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources index 2237bac..ceb8afd 100644 --- a/tools/perf/util/python-ext-sources +++ b/tools/perf/util/python-ext-sources @@ -18,6 +18,7 @@ util/namespaces.c ../lib/hweight.c ../lib/string.c ../lib/vsprintf.c +../lib/zalloc.c util/thread_map.c util/util.c util/xyarray.c diff --git a/tools/perf/util/s390-cpumsf.c b/tools/perf/util/s390-cpumsf.c index 10d36d9..ea66970 100644 --- a/tools/perf/util/s390-cpumsf.c +++ b/tools/perf/util/s390-cpumsf.c @@ -146,6 +146,7 @@ #include #include #include +#include #include #include @@ -156,7 +157,6 @@ #include "evlist.h" #include "machine.h" #include "session.h" -#include "util.h" #include "thread.h" #include "debug.h" #include "auxtrace.h" diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index e3463df..d0fd6c61 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -18,7 +19,6 @@ #include "session.h" #include "tool.h" #include "sort.h" -#include "util.h" #include "cpumap.h" #include "perf_regs.h" #include "asm/bug.h" diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index dcad75d..6ccf6f6 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -6,9 +6,9 @@ #include #include +#include #include "util/dso.h" -#include "util/util.h" #include "util/debug.h" #include "util/callchain.h" #include "util/symbol_conf.h" diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index d91fe75..c967715 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -6,6 +6,7 @@ #include "evlist.h" #include "evsel.h" #include "thread_map.h" +#include void update_stats(struct stats *stats, u64 val) { diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c index 54336df..2ce0dc8 100644 --- a/tools/perf/util/strbuf.c +++ b/tools/perf/util/strbuf.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "debug.h" -#include "util.h" #include +#include #include #include diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c index 90ea2b2..78aa4c3 100644 --- a/tools/perf/util/strfilter.c +++ b/tools/perf/util/strfilter.c @@ -1,11 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 -#include "util.h" #include "string2.h" #include "strfilter.h" #include +#include #include #include +#include /* Operators */ static const char *OP_and = "&"; /* Logical AND */ diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c index af45c6f..8a868cb 100644 --- a/tools/perf/util/strlist.c +++ b/tools/perf/util/strlist.c @@ -4,12 +4,12 @@ */ #include "strlist.h" -#include "util.h" #include #include #include #include #include +#include static struct rb_node *strlist__node_new(struct rblist *rblist, const void *entry) diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index fab8a04..76cc540 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c @@ -15,10 +15,10 @@ #include #include #include +#include #include "perf.h" #include "svghelper.h" -#include "util.h" #include "cpumap.h" static u64 first_time, last_time; diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 4299209..ad683fb 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -17,6 +17,7 @@ #include "debug.h" #include "util.h" #include +#include #include #ifndef EM_AARCH64 diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c index c8b7cad..3bc8b7e 100644 --- a/tools/perf/util/symbol-minimal.c +++ b/tools/perf/util/symbol-minimal.c @@ -10,7 +10,7 @@ #include #include #include - +#include static bool check_need_swap(int file_endian) { diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index ae2ce25..173f337 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -26,6 +26,7 @@ #include "header.h" #include "path.h" #include +#include #include #include diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c index c2037ac..022a9c6 100644 --- a/tools/perf/util/syscalltbl.c +++ b/tools/perf/util/syscalltbl.c @@ -10,9 +10,9 @@ #include #ifdef HAVE_SYSCALL_TABLE_SUPPORT +#include #include #include "string2.h" -#include "util.h" #if defined(__x86_64__) #include diff --git a/tools/perf/util/thread-stack.c b/tools/perf/util/thread-stack.c index 48d585a..15134ac 100644 --- a/tools/perf/util/thread-stack.c +++ b/tools/perf/util/thread-stack.c @@ -7,13 +7,13 @@ #include #include #include +#include #include #include #include "thread.h" #include "event.h" #include "machine.h" #include "env.h" -#include "util.h" #include "debug.h" #include "symbol.h" #include "comm.h" diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 3e29a4e..bbfb9c7 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -5,10 +5,10 @@ #include #include #include +#include #include "session.h" #include "thread.h" #include "thread-stack.h" -#include "util.h" #include "debug.h" #include "namespaces.h" #include "comm.h" diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index 281bf06..c291874 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c @@ -13,9 +13,9 @@ #include #include #include +#include #include "asm/bug.h" #include "thread_map.h" -#include "util.h" #include "debug.h" #include "event.h" diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index 806a11b..4550015 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "../perf.h" #include "trace-event.h" diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c index b023db1..ba58f69 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c @@ -12,8 +12,8 @@ #include "../perf.h" #include "debug.h" -#include "util.h" #include "trace-event.h" +#include struct scripting_context *scripting_context; diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index 407d016..28f71ca 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c @@ -12,6 +12,7 @@ #include "symbol.h" #include "thread.h" #include +#include #include "event.h" #include "perf_regs.h" #include "callchain.h" diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index cfc4d85..dc7a469 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -9,8 +9,6 @@ #include #include #include -#include -#include #include #include @@ -18,13 +16,6 @@ void usage(const char *err) __noreturn; void die(const char *err, ...) __noreturn __printf(1, 2); -static inline void *zalloc(size_t size) -{ - return calloc(1, size); -} - -#define zfree(ptr) ({ free(*ptr); *ptr = NULL; }) - struct dirent; struct nsinfo; struct strlist; diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c index 4b7a303..c59154e 100644 --- a/tools/perf/util/values.c +++ b/tools/perf/util/values.c @@ -3,8 +3,8 @@ #include #include #include +#include -#include "util.h" #include "values.h" #include "debug.h" diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c index 5031b7b..7f427ba 100644 --- a/tools/perf/util/vdso.c +++ b/tools/perf/util/vdso.c @@ -16,6 +16,7 @@ #include "machine.h" #include "thread.h" #include "linux/string.h" +#include #include "debug.h" /* diff --git a/tools/perf/util/xyarray.c b/tools/perf/util/xyarray.c index dc95154..86889eb 100644 --- a/tools/perf/util/xyarray.c +++ b/tools/perf/util/xyarray.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 #include "xyarray.h" -#include "util.h" #include #include +#include struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size) { -- 2.7.4