perf tools: Add reallocarray_as_needed()
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 11 Jul 2022 09:32:06 +0000 (12:32 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 20 Jul 2022 14:08:37 +0000 (11:08 -0300)
commit10d34700223b14ed94a6399cf026142956f87965
treefbb9e3142583266b2d1622cb861df04d23e9b8b2
parenta5367ecb5353fbf28bfd3979fc4f61ddebec80b1
perf tools: Add reallocarray_as_needed()

Add helper reallocarray_as_needed() to reallocate an array to a larger
size and initialize the extra entries to an arbitrary value.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: kvm@vger.kernel.org
Link: https://lore.kernel.org/r/20220711093218.10967-24-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/util.c
tools/perf/util/util.h